[GitHub] [hudi] nsivabalan commented on a change in pull request #2769: [HUDI-1762] Added HiveStylePartitionExtractor to support Hive style partitions
nsivabalan commented on a change in pull request #2769: URL: https://github.com/apache/hudi/pull/2769#discussion_r610346604 ## 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. + * + * This implementation extracts the partition value of -mm-dd from the path of type datestr=-mm-dd. + */ +public class HiveStylePartitionValueExtractor implements PartitionValueExtractor { + private static final long serialVersionUID = 1L; + + @Override + public List extractPartitionValuesInPath(String partitionPath) { +// partition path is expected to be in this format partition_key=partition_value. +String[] splits = partitionPath.split("="); Review comment: awesome, sounds good. -- 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
[GitHub] [hudi] nsivabalan commented on a change in pull request #2769: [HUDI-1762] Added HiveStylePartitionExtractor to support Hive style partitions
nsivabalan commented on a change in pull request #2769: URL: https://github.com/apache/hudi/pull/2769#discussion_r608577463 ## 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. + * + * This implementation extracts the partition value of -mm-dd from the path of type datestr=-mm-dd. + */ +public class HiveStylePartitionValueExtractor implements PartitionValueExtractor { + private static final long serialVersionUID = 1L; + + @Override + public List extractPartitionValuesInPath(String partitionPath) { +// partition path is expected to be in this format partition_key=partition_value. +String[] splits = partitionPath.split("="); Review comment: may be I am being very nit picky. but is there a chance that partitionpath has "=" in its field name? I know it does not make sense. anyways. partitionpath field name = "datestr" in your example. can it be "partition=path" ? If yes, Collections.singletonList(splits[1]) at line 40 might break right? @n3nash : do we make any such assumptions in hudi's code base wrt partition path's field name? -- 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
[GitHub] [hudi] nsivabalan commented on a change in pull request #2769: [HUDI-1762] Added HiveStylePartitionExtractor to support Hive style partitions
nsivabalan commented on a change in pull request #2769: URL: https://github.com/apache/hudi/pull/2769#discussion_r606914161 ## File path: hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveStylePartitionValueExtractor.java ## @@ -0,0 +1,37 @@ +/* + * 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; + +public class HiveStylePartitionValueExtractor implements PartitionValueExtractor { Review comment: java docs please. add add an example for format. ## File path: hudi-sync/hudi-hive-sync/src/test/java/org/apache/hudi/hive/TestPartitionValueExtractor.java ## @@ -19,6 +19,7 @@ package org.apache.hudi.hive; import org.junit.jupiter.api.Test; + Review comment: can we revert unintended changes please -- 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