pvary commented on code in PR #17878:
URL: https://github.com/apache/iceberg/pull/17878#discussion_r3892689173
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/source/IcebergTableSource.java:
##########
@@ -228,6 +251,30 @@ public Optional<Integer> getParallelism() {
};
}
+ @Override
+ public TableStats reportStatistics() {
+ try {
+ if (!FlinkSource.isBounded(properties)) {
+ return TableStats.UNKNOWN;
+ }
+
+ if (TIME_TRAVEL_OPTIONS.stream().anyMatch(properties::containsKey)) {
+ return TableStats.UNKNOWN;
+ }
+
+ boolean columnStatsEnabled =
+
readableConfig.get(FlinkConfigOptions.TABLE_EXEC_ICEBERG_REPORT_COLUMN_STATISTICS);
+ try (TableLoader tableLoader = loader.clone()) {
+ tableLoader.open();
+ Table table = tableLoader.loadTable();
+ return FlinkTableStatistics.reportStatistics(table, filters,
columnStatsEnabled);
+ }
+ } catch (Exception e) {
+ LOG.warn("Failed to report statistics for Iceberg table, returning
unknown stats", e);
+ return TableStats.UNKNOWN;
+ }
Review Comment:
We need to load the table anyway in the `IcebergSource.build`, so we might
as well do this here, and provide the table through the builder.
--
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]