saitharun15 commented on code in PR #11615:
URL: https://github.com/apache/iceberg/pull/11615#discussion_r1854320423


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScan.java:
##########
@@ -194,10 +205,40 @@ protected Statistics estimateStatistics(Snapshot 
snapshot) {
     Map<NamedReference, ColumnStatistics> colStatsMap = Collections.emptyMap();
     if (readConf.reportColumnStats() && cboEnabled) {
       colStatsMap = Maps.newHashMap();
+      Map<Integer, Long> ndvs = Maps.newHashMap();
+      Map<Integer, Long> nullCounts = Maps.newHashMap();
+      Map<Integer, Object> minValues = Maps.newHashMap();
+      Map<Integer, Object> maxValues = Maps.newHashMap();
       List<StatisticsFile> files = table.statisticsFiles();
       if (!files.isEmpty()) {
         List<BlobMetadata> metadataList = (files.get(0)).blobMetadata();
 
+        if (readConf.deriveStatsFromManifestSessionConf()
+            || readConf.deriveStatsFromManifestTableProperty()) {
+          Map<String, Map<Integer, Long>> distinctDataFilesNullCount = 
Maps.newHashMap();
+          Map<String, Map<Integer, ByteBuffer>> distinctDataFilesMin = 
Maps.newHashMap();
+          Map<String, Map<Integer, ByteBuffer>> distinctDataFilesMax = 
Maps.newHashMap();
+
+          // extract the distinct files which are part of the task planning
+          for (ScanTaskGroup<?> taskGrp : taskGroups()) {
+            for (ScanTask task : taskGrp.tasks()) {
+              if (task.isFileScanTask()) {
+                FileScanTask fileScanTask = task.asFileScanTask();

Review Comment:
   Updated to collect dataFiles into a set, Thanks!



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