rdblue commented on a change in pull request #830: Support name mapping 
resolution for parquet
URL: https://github.com/apache/incubator-iceberg/pull/830#discussion_r406851758
 
 

 ##########
 File path: 
parquet/src/main/java/org/apache/iceberg/parquet/ParquetSchemaUtil.java
 ##########
 @@ -112,4 +127,56 @@ public static MessageType addFallbackIds(MessageType 
fileSchema) {
 
     return builder.named(fileSchema.getName());
   }
+
+  public static MessageType addFallbackIds(MessageType fileSchema, NameMapping 
nameMapping) {
+    MessageTypeBuilder builder = 
org.apache.parquet.schema.Types.buildMessage();
+
+    for (Type type : fileSchema.getFields()) {
+      if (nameMapping.find(type.getName()) != null) {
+        builder.addField(type.withId(nameMapping.find(type.getName()).id()));
+      }
+    }
+
+    return builder.named(fileSchema.getName());
+  }
+
+  public static class HasIds extends ParquetTypeVisitor<Boolean> {
 
 Review comment:
   This looks 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to