Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class TimestampBasedKeyGenerator extends SimpleKeyGenerator {

enum TimestampType implements Serializable {
UNIX_TIMESTAMP, DATE_STRING, MIXED
UNIX_TIMESTAMP, DATE_STRING, MIXED, EPOCHMILLISECONDS
}

private final TimestampType timestampType;
Expand Down Expand Up @@ -97,9 +97,10 @@ public HoodieKey getKey(GenericRecord record) {
throw new HoodieNotSupportedException(
"Unexpected type for partition field: " + partitionVal.getClass().getName());
}
Date timestamp = this.timestampType == TimestampType.EPOCHMILLISECONDS ? new Date(unixTime) : new Date(unixTime * 1000);

return new HoodieKey(DataSourceUtils.getNestedFieldValAsString(record, recordKeyField),
partitionPathFormat.format(new Date(unixTime * 1000)));
partitionPathFormat.format(timestamp));
} catch (ParseException pe) {
throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, pe);
}
Expand Down