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


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScan.java:
##########
@@ -248,6 +296,88 @@ protected Statistics estimateStatistics(Snapshot snapshot) 
{
     return new Stats(sizeInBytes, rowsCount, colStatsMap);
   }
 
+  private Map<Integer, Long> calculateNullCount(
+      Map<String, Map<Integer, Long>> distinctDataFilesNullCount) {
+    Map<Integer, Long> nullCount;
+    // get the null counts from the manifest file
+    nullCount =
+        distinctDataFilesNullCount.values().stream() // Stream<Map<Integer, 
Long>>
+            .flatMap(
+                innerMap ->
+                    innerMap.entrySet().stream()) // Flatten to 
Stream<Map.Entry<Integer, Long>>
+            .collect(
+                Collectors.toMap(
+                    Map.Entry::getKey, // Key is the column id
+                    Map.Entry::getValue,
+                    Long::sum,
+                    HashMap::new));
+    return nullCount;
+  }
+
+  private Object toSparkType(Type type, Object value) {
+    switch (type.typeId()) {
+      case DECIMAL:
+        return Decimal.apply((BigDecimal) value);
+      default:
+    }
+    return value;
+  }
+
+  // min/max are calculated for numeric, Date, and Timestamp only
+  private boolean isValidMinMaxType(Type type) {
+    switch (type.typeId()) {
+      case DATE:
+      case TIMESTAMP:
+      case INTEGER:
+      case LONG:
+      case FLOAT:
+      case DOUBLE:
+      case DECIMAL:
+      case BOOLEAN:
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  // extract min/max values from the manifests
+  private Map<Integer, Object> calculateMinMax(

Review Comment:
   This may have errors if any delete files are present or if there are any non 
file covering predicates in the query



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