wangxianghu commented on a change in pull request #2122:
URL: https://github.com/apache/hudi/pull/2122#discussion_r495663737



##########
File path: 
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/SlashEncodedDayPartitionValueExtractor.java
##########
@@ -36,30 +36,40 @@
   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) {
+
+    int year = 0;
+    int mm = 0;
+    int dd = 0;
+    int hh = 0;
     // 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);
+    if (splits.length == 3 || splits.length == 4) {

Review comment:
       The rest LGTM cc @yanghua 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to