diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java index 77048ae3d89d..b355aa18a833 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java @@ -325,7 +325,9 @@ public IcebergTableHandle getTableHandle( table.location(), table.properties(), NO_RETRIES, - ImmutableList.of()); + ImmutableList.of(), + false, + Optional.empty()); } @Override @@ -1716,7 +1718,8 @@ public Optional> applyFilter(C } return Optional.of(new ConstraintApplicationResult<>( - new IcebergTableHandle(table.getSchemaName(), + new IcebergTableHandle( + table.getSchemaName(), table.getTableName(), table.getTableType(), table.getSnapshotId(), @@ -1730,7 +1733,9 @@ public Optional> applyFilter(C table.getTableLocation(), table.getStorageProperties(), table.getRetryMode(), - table.getUpdatedColumns()), + table.getUpdatedColumns(), + table.isRecordScannedFiles(), + table.getMaxScannedFileSize()), remainingConstraint.transformKeys(ColumnHandle.class::cast), false)); } diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableHandle.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableHandle.java index e2076e529a2d..a0e822199ce1 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableHandle.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableHandle.java @@ -65,7 +65,7 @@ public class IcebergTableHandle private final Optional maxScannedFileSize; @JsonCreator - public IcebergTableHandle( + public static IcebergTableHandle fromJsonForDeserializationOnly( @JsonProperty("schemaName") String schemaName, @JsonProperty("tableName") String tableName, @JsonProperty("tableType") TableType tableType, @@ -82,7 +82,7 @@ public IcebergTableHandle( @JsonProperty("retryMode") RetryMode retryMode, @JsonProperty("updatedColumns") List updatedColumns) { - this( + return new IcebergTableHandle( schemaName, tableName, tableType, diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergNodeLocalDynamicSplitPruning.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergNodeLocalDynamicSplitPruning.java index 266215721217..33132685e408 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergNodeLocalDynamicSplitPruning.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergNodeLocalDynamicSplitPruning.java @@ -182,7 +182,9 @@ private static ConnectorPageSource createTestingPageSource(HiveTransactionHandle outputFile.getParentFile().getAbsolutePath(), ImmutableMap.of(), RetryMode.NO_RETRIES, - ImmutableList.of()), + ImmutableList.of(), + false, + Optional.empty()), transaction); FileFormatDataSourceStats stats = new FileFormatDataSourceStats(); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java index d26c488e8a41..0c4a383148ce 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java @@ -137,9 +137,11 @@ public void testIncompleteDynamicFilterTimeout() nationTable.location(), nationTable.properties(), NO_RETRIES, - ImmutableList.of()); + ImmutableList.of(), + false, + Optional.empty()); - IcebergSplitSource splitSource = new IcebergSplitSource( + try (IcebergSplitSource splitSource = new IcebergSplitSource( tableHandle, nationTable.newScan(), Optional.empty(), @@ -186,21 +188,21 @@ public TupleDomain getCurrentPredicate() alwaysTrue(), new TestingTypeManager(), false, - new IcebergConfig().getMinimumAssignedSplitWeight()); - - ImmutableList.Builder splits = ImmutableList.builder(); - while (!splitSource.isFinished()) { - splitSource.getNextBatch(null, 100).get() - .getSplits() - .stream() - .map(IcebergSplit.class::cast) - .forEach(splits::add); + new IcebergConfig().getMinimumAssignedSplitWeight())) { + ImmutableList.Builder splits = ImmutableList.builder(); + while (!splitSource.isFinished()) { + splitSource.getNextBatch(null, 100).get() + .getSplits() + .stream() + .map(IcebergSplit.class::cast) + .forEach(splits::add); + } + assertThat(splits.build().size()).isGreaterThan(0); + assertTrue(splitSource.isFinished()); + assertThat(System.currentTimeMillis() - startMillis) + .as("IcebergSplitSource failed to wait for dynamicFilteringWaitTimeout") + .isGreaterThanOrEqualTo(2000); } - assertThat(splits.build().size()).isGreaterThan(0); - assertTrue(splitSource.isFinished()); - assertThat(System.currentTimeMillis() - startMillis) - .as("IcebergSplitSource failed to wait for dynamicFilteringWaitTimeout") - .isGreaterThanOrEqualTo(2000); } @Test diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/optimizer/TestConnectorPushdownRulesWithIceberg.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/optimizer/TestConnectorPushdownRulesWithIceberg.java index 22f7dae0155c..4976d3aec498 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/optimizer/TestConnectorPushdownRulesWithIceberg.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/optimizer/TestConnectorPushdownRulesWithIceberg.java @@ -165,8 +165,24 @@ public void testProjectionPushdown() BIGINT, Optional.empty()); - IcebergTableHandle icebergTable = new IcebergTableHandle(SCHEMA_NAME, tableName, DATA, Optional.of(1L), "", "", 1, - TupleDomain.all(), TupleDomain.all(), ImmutableSet.of(), Optional.empty(), "", ImmutableMap.of(), NO_RETRIES, ImmutableList.of()); + IcebergTableHandle icebergTable = new IcebergTableHandle( + SCHEMA_NAME, + tableName, + DATA, + Optional.of(1L), + "", + "", + 1, + TupleDomain.all(), + TupleDomain.all(), + ImmutableSet.of(), + Optional.empty(), + "", + ImmutableMap.of(), + NO_RETRIES, + ImmutableList.of(), + false, + Optional.empty()); TableHandle table = new TableHandle(new CatalogName(ICEBERG_CATALOG_NAME), icebergTable, new HiveTransactionHandle(false)); IcebergColumnHandle fullColumn = partialColumn.getBaseColumn(); @@ -230,8 +246,24 @@ public void testPredicatePushdown() PushPredicateIntoTableScan pushPredicateIntoTableScan = new PushPredicateIntoTableScan(tester().getPlannerContext(), tester().getTypeAnalyzer()); - IcebergTableHandle icebergTable = new IcebergTableHandle(SCHEMA_NAME, tableName, DATA, Optional.of(1L), "", "", 1, - TupleDomain.all(), TupleDomain.all(), ImmutableSet.of(), Optional.empty(), "", ImmutableMap.of(), NO_RETRIES, ImmutableList.of()); + IcebergTableHandle icebergTable = new IcebergTableHandle( + SCHEMA_NAME, + tableName, + DATA, + Optional.of(1L), + "", + "", + 1, + TupleDomain.all(), + TupleDomain.all(), + ImmutableSet.of(), + Optional.empty(), + "", + ImmutableMap.of(), + NO_RETRIES, + ImmutableList.of(), + false, + Optional.empty()); TableHandle table = new TableHandle(new CatalogName(ICEBERG_CATALOG_NAME), icebergTable, new HiveTransactionHandle(false)); IcebergColumnHandle column = new IcebergColumnHandle(primitiveColumnIdentity(1, "a"), INTEGER, ImmutableList.of(), INTEGER, Optional.empty()); @@ -263,8 +295,24 @@ public void testColumnPruningProjectionPushdown() PruneTableScanColumns pruneTableScanColumns = new PruneTableScanColumns(tester().getMetadata()); - IcebergTableHandle icebergTable = new IcebergTableHandle(SCHEMA_NAME, tableName, DATA, Optional.empty(), "", "", 1, - TupleDomain.all(), TupleDomain.all(), ImmutableSet.of(), Optional.empty(), "", ImmutableMap.of(), NO_RETRIES, ImmutableList.of()); + IcebergTableHandle icebergTable = new IcebergTableHandle( + SCHEMA_NAME, + tableName, + DATA, + Optional.empty(), + "", + "", + 1, + TupleDomain.all(), + TupleDomain.all(), + ImmutableSet.of(), + Optional.empty(), + "", + ImmutableMap.of(), + NO_RETRIES, + ImmutableList.of(), + false, + Optional.empty()); TableHandle table = new TableHandle(new CatalogName(ICEBERG_CATALOG_NAME), icebergTable, new HiveTransactionHandle(false)); IcebergColumnHandle columnA = new IcebergColumnHandle(primitiveColumnIdentity(0, "a"), INTEGER, ImmutableList.of(), INTEGER, Optional.empty()); @@ -307,8 +355,24 @@ public void testPushdownWithDuplicateExpressions() tester().getTypeAnalyzer(), new ScalarStatsCalculator(tester().getPlannerContext(), tester().getTypeAnalyzer())); - IcebergTableHandle icebergTable = new IcebergTableHandle(SCHEMA_NAME, tableName, DATA, Optional.of(1L), "", "", 1, - TupleDomain.all(), TupleDomain.all(), ImmutableSet.of(), Optional.empty(), "", ImmutableMap.of(), NO_RETRIES, ImmutableList.of()); + IcebergTableHandle icebergTable = new IcebergTableHandle( + SCHEMA_NAME, + tableName, + DATA, + Optional.of(1L), + "", + "", + 1, + TupleDomain.all(), + TupleDomain.all(), + ImmutableSet.of(), + Optional.empty(), + "", + ImmutableMap.of(), + NO_RETRIES, + ImmutableList.of(), + false, + Optional.empty()); TableHandle table = new TableHandle(new CatalogName(ICEBERG_CATALOG_NAME), icebergTable, new HiveTransactionHandle(false)); IcebergColumnHandle bigintColumn = new IcebergColumnHandle(primitiveColumnIdentity(1, "just_bigint"), BIGINT, ImmutableList.of(), BIGINT, Optional.empty());