wangxianghu commented on a change in pull request #1920:
URL: https://github.com/apache/hudi/pull/1920#discussion_r474739944
##########
File path:
hudi-spark/src/main/java/org/apache/hudi/keygen/TimestampBasedKeyGenerator.java
##########
@@ -199,6 +202,32 @@ private String getPartitionPath(Object partitionVal) {
return hiveStylePartitioning ? getPartitionPathFields().get(0) + "=" +
partitionPath : partitionPath;
}
+ /**
+ * Set default value to partitionVal if the input value of
partitionPathField is null.
+ */
+ private Object getDefaultPartitionVal() {
+ Object result = 1L;
+ if (timestampType == TimestampType.DATE_STRING || timestampType ==
TimestampType.MIXED) {
+ // since partitionVal is null, we can set a default value of any format
as TIMESTAMP_INPUT_DATE_FORMAT_PROP
+ // configured, here we take the first.
+ String delimiter = ((HoodieDateTimeParserImpl)
parser).getConfigInputDateFormatDelimiter();
Review comment:
> For safety, you should judge if the parser is the instance of
`HoodieDateTimeParserImpl `. Although, there is only one implementation
currently.
done, I have refactored HoodieDateTimeParser to expose some tool methods.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]