timothyw553 commented on code in PR #18883:
URL: https://github.com/apache/iceberg/pull/18883#discussion_r4724519131
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTScanPlanning.java:
##########
@@ -307,6 +308,35 @@ void scanPlanningWithBatchScan(
}
}
+ @ParameterizedTest
+ @EnumSource(PlanningMode.class)
+ void columnStatsOutsideProjection(
+ Function<TestPlanningBehavior.Builder, TestPlanningBehavior.Builder>
planMode)
+ throws IOException {
+ configurePlanningBehavior(planMode);
+ restCatalog.createNamespace(NS);
+ Table table =
+ restCatalog.createTable(TableIdentifier.of(NS,
"stats_outside_projection"), SCHEMA);
+ int statsFieldId = table.schema().findField("data").fieldId();
+ long recordCount = 2L;
+ Map<Integer, Long> valueCounts = Map.of(statsFieldId, recordCount);
+ DataFile file =
+ DataFiles.builder(table.spec())
+ .withPath("/path/to/stats.parquet")
+ .withFileSizeInBytes(10)
+ .withMetrics(new Metrics(recordCount, null, valueCounts, null,
null, null, null))
+ .build();
+ table.newAppend().appendFile(file).commit();
+ setParserContext(table);
+
+ try (CloseableIterable<FileScanTask> tasks =
+
table.newScan().select("id").includeColumnStats(List.of("data")).planFiles()) {
Review Comment:
this test still passes if `RESTTableScan` uses `table().schema()` instead of
`tableSchema()`. could we add a time-travel case where `data` is renamed after
a snapshot, then scan that snapshot selecting `id` and assert
`captureLastPlanRequest().statsFields()` has `data`?
--
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]