dramaticlly commented on code in PR #10547:
URL: https://github.com/apache/iceberg/pull/10547#discussion_r1663244200


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -375,30 +374,33 @@ private Schema schemaWithMetadataColumns() {
             .distinct()
             .map(name -> MetadataColumns.metadataColumn(table, name))
             .collect(Collectors.toList());
-    // only calculate potential column id collision if _partition was requested
-    Schema metadataSchema =
-        metadataFields.isEmpty() || 
!metaColumns.contains(MetadataColumns.PARTITION_COLUMN_NAME)
-            ? new Schema(metadataFields)
-            : deduplicateSchemaIds(metadataFields);
+    Schema metadataSchema = calculateMetadataSchema(metadataFields);
 
     // schema or rows returned by readers
     return TypeUtil.join(schema, metadataSchema);
   }
 
-  private Schema deduplicateSchemaIds(List<Types.NestedField> 
metaColumnFields) {
-    Map<Integer, Types.NestedField> indexedMetadataColumnFields =
-        TypeUtil.indexById(Types.StructType.of(metaColumnFields));
+  private Schema calculateMetadataSchema(List<Types.NestedField> 
metaColumnFields) {
+    // only calculate potential column id collision if _partition was requested
+    boolean requireDeduplicateSchemaIds =

Review Comment:
   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.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to