wangxianghu commented on a change in pull request #2122:
URL: https://github.com/apache/hudi/pull/2122#discussion_r495775215
##########
File path:
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/SlashEncodedDayPartitionValueExtractor.java
##########
@@ -36,30 +36,35 @@
private static final long serialVersionUID = 1L;
private transient DateTimeFormatter dtfOut;
- public SlashEncodedDayPartitionValueExtractor() {
- this.dtfOut = DateTimeFormat.forPattern("yyyy-MM-dd");
- }
-
- private DateTimeFormatter getDtfOut() {
- if (dtfOut == null) {
- dtfOut = DateTimeFormat.forPattern("yyyy-MM-dd");
- }
- return dtfOut;
- }
-
@Override
public List<String> extractPartitionValuesInPath(String partitionPath) {
+
// partition path is expected to be in this format yyyy/mm/dd
String[] splits = partitionPath.split("/");
- if (splits.length != 3) {
- throw new IllegalArgumentException("Partition path " + partitionPath + "
is not in the form yyyy/mm/dd ");
+ if (splits.length != 3 && splits.length != 4) {
+ throw new IllegalArgumentException("Partition path " + partitionPath + "
is not in the form yyyy/mm/dd or yyyy/mm/dd/HH");
}
// Get the partition part and remove the / as well at the end
int year = Integer.parseInt(splits[0].contains("=") ?
splits[0].split("=")[1] : splits[0]);
int mm = Integer.parseInt(splits[1].contains("=") ?
splits[1].split("=")[1] : splits[1]);
int dd = Integer.parseInt(splits[2].contains("=") ?
splits[2].split("=")[1] : splits[2]);
- DateTime dateTime = new DateTime(year, mm, dd, 0, 0);
+ int hh = 0;
Review comment:
@liujinhui1994 Thanks for addressing my concern, LGTM now
----------------------------------------------------------------
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]