[ 
https://issues.apache.org/jira/browse/PARQUET-1951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258542#comment-17258542
 ] 

ASF GitHub Bot commented on PARQUET-1951:
-----------------------------------------

satishkotha commented on a change in pull request #847:
URL: https://github.com/apache/parquet-mr/pull/847#discussion_r551598592



##########
File path: 
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/metadata/KeyValueMetadataMergeStrategy.java
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.parquet.hadoop.metadata;
+
+import org.apache.parquet.schema.MessageType;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+
+import static java.util.Collections.unmodifiableMap;
+
+/**
+ * Strategy to merge metadata. Possible implementations:
+ * 1) Expect metadata to be exactly identical. Otherwise throw error (this is 
the default strategy implementation)
+ * 2) Custom strategy to merge metadata if the values are not identical. 
Example: concatenate values.
+ */
+public interface KeyValueMetadataMergeStrategy extends Serializable {
+  /**
+   * @param keyValueMetaData the merged app specific metadata
+   *
+   * @throws NullPointerException if keyValueMetaData is {@code null}
+   */
+  Map<String, String> merge(Map<String, Set<String>> keyValueMetaData);

Review comment:
       GlobalMetadata uses Map<String, Set \<String\>> 
https://github.com/apache/parquet-mr/blob/master/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/metadata/GlobalMetaData.java#L41.
 So merge method takes in same argument.
   
   Do you think it makes sense to change GlobalMetadata to track items in 
List<String>? I'm not sure if it would be backward compatible and if there are 
use cases expecting this to be Set.  
   
   Without changing GlobalMetadata#keyValueMetaData, it may not be useful to 
change this interface. Let me know what you think.




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


> Allow different strategies to combine key values when merging parquet files
> ---------------------------------------------------------------------------
>
>                 Key: PARQUET-1951
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1951
>             Project: Parquet
>          Issue Type: Improvement
>            Reporter: satish
>            Priority: Minor
>
> I work on Apache Hudi project. We store some additional metadata in parquet 
> files (key range in the file, for example).  So the metadata is different in 
> different parquet files that we want to merge these files. 
> Here is what I'm thinking:
> 1) Merge command takes additional command line option: --strategy 
> <StrategyClassName>. 
> 2) We introduce new strategy class in parquet-hadoop to keep the same 
> behavior as today.  
> We can extend that class and provide our custom implementation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to