nssalian commented on code in PR #16292:
URL: https://github.com/apache/iceberg/pull/16292#discussion_r3607104107


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -365,11 +372,23 @@ private BatchScan buildIcebergBatchScan(
 
     if (withStats) {
       scan = scan.includeColumnStats();
+    } else {
+      List<String> variantColumns = variantColumnNames(projection);
+      if (!variantColumns.isEmpty()) {
+        scan = scan.includeColumnStats(variantColumns);
+      }
     }
 
     return configureSplitPlanning(scan);
   }
 
+  private List<String> variantColumnNames(Schema projection) {
+    return projection.columns().stream()
+        .filter(field -> field.type().isVariantType())
+        .map(Types.NestedField::name)
+        .collect(Collectors.toList());
+  }

Review Comment:
   Will clean this up. 



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