You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/06/25 16:06:07 UTC

[GitHub] [iceberg] singhpk234 commented on a diff in pull request #5075: Spark: Add `__metadata_col` metadata in metadata columns when doing Schema Conversion

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


##########
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:
   makes sense, made it consistent to 3.3 review comments as well.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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