1
0

[HUDI-2177][HUDI-2200] Adding virtual keys support for MOR table (#3315)

This commit is contained in:
Sivabalan Narayanan
2021-08-02 09:45:09 -04:00
committed by GitHub
parent dde57b293c
commit fe508376fa
37 changed files with 633 additions and 261 deletions

View File

@@ -75,11 +75,17 @@ public class SampleTestRecord implements Serializable {
private String[] stringArray;
public SampleTestRecord(String instantTime, int recordNumber, String fileId) {
this._hoodie_commit_time = instantTime;
this._hoodie_record_key = "key" + recordNumber;
this._hoodie_partition_path = instantTime;
this._hoodie_file_name = fileId;
this._hoodie_commit_seqno = instantTime + recordNumber;
this(instantTime, recordNumber, fileId, true);
}
public SampleTestRecord(String instantTime, int recordNumber, String fileId, boolean populateMetaFields) {
if (populateMetaFields) {
this._hoodie_commit_time = instantTime;
this._hoodie_record_key = "key" + recordNumber;
this._hoodie_partition_path = instantTime;
this._hoodie_file_name = fileId;
this._hoodie_commit_seqno = instantTime + recordNumber;
}
String commitTimeSuffix = "@" + instantTime;
int commitHashCode = instantTime.hashCode();

View File

@@ -185,8 +185,13 @@ public final class SchemaTestUtil {
}
public static GenericRecord generateAvroRecordFromJson(Schema schema, int recordNumber, String instantTime,
String fileId) throws IOException {
SampleTestRecord record = new SampleTestRecord(instantTime, recordNumber, fileId);
String fileId) throws IOException {
return generateAvroRecordFromJson(schema, recordNumber, instantTime, fileId, true);
}
public static GenericRecord generateAvroRecordFromJson(Schema schema, int recordNumber, String instantTime,
String fileId, boolean populateMetaFields) throws IOException {
SampleTestRecord record = new SampleTestRecord(instantTime, recordNumber, fileId, populateMetaFields);
MercifulJsonConverter converter = new MercifulJsonConverter();
return converter.convert(record.toJsonString(), schema);
}