vingov commented on a change in pull request #2769:
URL: https://github.com/apache/hudi/pull/2769#discussion_r610344542



##########
File path: 
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveStylePartitionValueExtractor.java
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.hive;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Extractor for Hive Style Partitioned tables, when the parition folders are 
key value pairs.
+ *
+ * <p>This implementation extracts the partition value of yyyy-mm-dd from the 
path of type datestr=yyyy-mm-dd.
+ */
+public class HiveStylePartitionValueExtractor implements 
PartitionValueExtractor {
+  private static final long serialVersionUID = 1L;
+
+  @Override
+  public List<String> extractPartitionValuesInPath(String partitionPath) {
+    // partition path is expected to be in this format 
partition_key=partition_value.
+    String[] splits = partitionPath.split("=");

Review comment:
       Good question!
   I have recreated the same scenario with `=` on both partition key and 
partition value, but both Hive and Spark encodes the `=` to `%3D` on both the 
partition keys and values.
   
   Look at this folder:
   `
   /tmp.db/ds_test/date%3Dstr=2021%3D04%3D09
   /tmp.db/ds_test/date%3Dstr=2021-04-08
   `
   Based on this test, we can see that the code won't break, let me know if I 
have missed anything.
   
   
[Here](https://github.com/apache/hudi/blob/3a926aacf6552fc06005db4a7880a233db904330/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java#L143)
 is the Hudi code to create hive style partitions.
   




-- 
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