anoopj commented on code in PR #18740:
URL: https://github.com/apache/iceberg/pull/18740#discussion_r4444215358


##########
core/src/test/java/org/apache/iceberg/TestFilePlanner.java:
##########
@@ -273,6 +274,58 @@ void filterHonorsCaseSensitivity(FileFormat format) throws 
IOException {
         .hasMessageContaining("Cannot find field 'ID'");
   }
 
+  @ParameterizedTest
+  @FieldSource("MANIFEST_FORMATS")
+  void columnStatsOmittedByDefault(FileFormat format) throws IOException {
+    ManifestFile root =
+        writeManifest(
+            format, EMPTY_PARTITION, 
ImmutableList.of(dataFileWithStats(FILE_A, idStats(0, 99))));
+
+    DataFile file = Iterables.getOnlyElement(plan(root, 
UNPARTITIONED_SPECS)).file();
+
+    assertThat(file.lowerBounds())
+        .as("no column stats are returned unless projectStats requests them")
+        .isNull();
+    assertThat(file.valueCounts()).as("value counts are also omitted by 
default").isNull();
+  }
+
+  @ParameterizedTest
+  @FieldSource("MANIFEST_FORMATS")
+  void projectStatsForwardedToRootAndLeafReaders(FileFormat format) throws 
IOException {
+    String rootFile = "s3://bucket/db/table/root.parquet";
+    String leafFile = "s3://bucket/db/table/leaf.parquet";
+    ManifestFile leaf =
+        writeManifest(
+            format,
+            EMPTY_PARTITION,
+            ImmutableList.of(dataFileWithStats(leafFile, idStats(100, 199))));
+    ManifestFile root =
+        writeManifest(
+            format,
+            EMPTY_PARTITION,
+            ImmutableList.of(
+                dataFileWithStats(rootFile, idStats(0, 99)), 
dataManifest(leaf.path())));
+
+    int idFieldId = TABLE_SCHEMA.findField("id").fieldId();
+    List<FileScanTask> tasks =
+        plan(root, UNPARTITIONED_SPECS, planner -> 
planner.projectStats(idFieldId));
+
+    assertThat(tasks)

Review Comment:
   Both done. Collapsed to a single tuple-extracting assertion over the shared 
file constants/. 



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