Support nested types for recordKey, partitionPath and combineKey
This commit is contained in:
committed by
vinoth chandar
parent
e43efa042f
commit
a7e6cf5197
@@ -243,7 +243,7 @@ public class HoodieDeltaStreamer implements Serializable {
|
||||
JavaRDD<GenericRecord> avroRDD = avroRDDOptional.get();
|
||||
JavaRDD<HoodieRecord> records = avroRDD.map(gr -> {
|
||||
HoodieRecordPayload payload = DataSourceUtils.createPayload(cfg.payloadClassName, gr,
|
||||
(Comparable) gr.get(cfg.sourceOrderingField));
|
||||
(Comparable) DataSourceUtils.getNestedFieldVal(gr, cfg.sourceOrderingField));
|
||||
return new HoodieRecord<>(keyGenerator.getKey(gr), payload);
|
||||
});
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TimestampBasedKeyGenerator extends SimpleKeyGenerator {
|
||||
|
||||
@Override
|
||||
public HoodieKey getKey(GenericRecord record) {
|
||||
Object partitionVal = record.get(partitionPathField);
|
||||
Object partitionVal = DataSourceUtils.getNestedFieldVal(record, partitionPathField);
|
||||
SimpleDateFormat partitionPathFormat = new SimpleDateFormat(outputDateFormat);
|
||||
partitionPathFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
@@ -102,7 +102,7 @@ public class TimestampBasedKeyGenerator extends SimpleKeyGenerator {
|
||||
"Unexpected type for partition field: " + partitionVal.getClass().getName());
|
||||
}
|
||||
|
||||
return new HoodieKey(record.get(recordKeyField).toString(),
|
||||
return new HoodieKey(DataSourceUtils.getNestedFieldValAsString(record, recordKeyField),
|
||||
partitionPathFormat.format(new Date(unixTime * 1000)));
|
||||
} catch (ParseException pe) {
|
||||
throw new HoodieDeltaStreamerException(
|
||||
|
||||
Reference in New Issue
Block a user