rdblue commented on code in PR #5075:
URL: https://github.com/apache/iceberg/pull/5075#discussion_r906567399


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/TypeToSparkType.java:
##########
@@ -59,8 +61,11 @@ public DataType struct(Types.StructType struct, 
List<DataType> fieldResults) {
     for (int i = 0; i < fields.size(); i += 1) {
       Types.NestedField field = fields.get(i);
       DataType type = fieldResults.get(i);
-      StructField sparkField = StructField.apply(
-          field.name(), type, field.isOptional(), Metadata.empty());
+      Metadata metadata = Metadata.empty();
+      if (MetadataColumns.isMetadataColumn(field.name())) {
+        metadata = new 
MetadataBuilder().putBoolean(MetadataColumns.METADATA_COL_ATTR_KEY, 
true).build();
+      }

Review Comment:
   Could this be refactored into a separate method? I think that would be 
cleaner. And, this should identify metadata columns using column IDs, since 
they are available in Iceberg schemas.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to