From 786a281729b61a71577ab1d0639f7c7c40eb1cac Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 22 Mar 2023 14:45:49 -0400 Subject: [PATCH] Remove unused updatedColumns from IcebergTableHandle --- .../trino/plugin/iceberg/IcebergMetadata.java | 4 -- .../plugin/iceberg/IcebergTableHandle.java | 62 ++++++------------- ...stIcebergNodeLocalDynamicSplitPruning.java | 1 - .../iceberg/TestIcebergSplitSource.java | 1 - ...TestConnectorPushdownRulesWithIceberg.java | 4 -- 5 files changed, 19 insertions(+), 53 deletions(-) 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 69815ac76ed9..73915aa952bf 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 @@ -407,7 +407,6 @@ public IcebergTableHandle getTableHandle( table.location(), table.properties(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); } @@ -2326,7 +2325,6 @@ else if (isMetadataColumnId(columnHandle.getId())) { table.getTableLocation(), table.getStorageProperties(), table.getRetryMode(), - table.getUpdatedColumns(), table.isRecordScannedFiles(), table.getMaxScannedFileSize()), remainingConstraint.transformKeys(ColumnHandle.class::cast), @@ -2455,7 +2453,6 @@ public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTab IcebergTableHandle originalHandle = (IcebergTableHandle) tableHandle; // Certain table handle attributes are not applicable to select queries (which need stats). // If this changes, the caching logic may here may need to be revised. - checkArgument(originalHandle.getUpdatedColumns().isEmpty(), "Unexpected updated columns"); checkArgument(!originalHandle.isRecordScannedFiles(), "Unexpected scanned files recording set"); checkArgument(originalHandle.getMaxScannedFileSize().isEmpty(), "Unexpected max scanned file size set"); @@ -2476,7 +2473,6 @@ public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTab originalHandle.getTableLocation(), originalHandle.getStorageProperties(), NO_RETRIES, // retry mode doesn't affect stats - originalHandle.getUpdatedColumns(), originalHandle.isRecordScannedFiles(), originalHandle.getMaxScannedFileSize()), handle -> { 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 b2cb24ae5c0d..055dc7943fe5 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 @@ -51,9 +51,6 @@ public class IcebergTableHandle private final Map storageProperties; private final RetryMode retryMode; - // UPDATE only - private final List updatedColumns; - // Filter used during split generation and table scan, but not required to be strictly enforced by Iceberg Connector private final TupleDomain unenforcedPredicate; @@ -83,8 +80,7 @@ public static IcebergTableHandle fromJsonForDeserializationOnly( @JsonProperty("nameMappingJson") Optional nameMappingJson, @JsonProperty("tableLocation") String tableLocation, @JsonProperty("storageProperties") Map storageProperties, - @JsonProperty("retryMode") RetryMode retryMode, - @JsonProperty("updatedColumns") List updatedColumns) + @JsonProperty("retryMode") RetryMode retryMode) { return new IcebergTableHandle( schemaName, @@ -102,7 +98,6 @@ public static IcebergTableHandle fromJsonForDeserializationOnly( tableLocation, storageProperties, retryMode, - updatedColumns, false, Optional.empty()); } @@ -123,7 +118,6 @@ public IcebergTableHandle( String tableLocation, Map storageProperties, RetryMode retryMode, - List updatedColumns, boolean recordScannedFiles, Optional maxScannedFileSize) { @@ -142,7 +136,6 @@ public IcebergTableHandle( this.tableLocation = requireNonNull(tableLocation, "tableLocation is null"); this.storageProperties = ImmutableMap.copyOf(requireNonNull(storageProperties, "storageProperties is null")); this.retryMode = requireNonNull(retryMode, "retryMode is null"); - this.updatedColumns = ImmutableList.copyOf(requireNonNull(updatedColumns, "updatedColumns is null")); this.recordScannedFiles = recordScannedFiles; this.maxScannedFileSize = requireNonNull(maxScannedFileSize, "maxScannedFileSize is null"); } @@ -238,12 +231,6 @@ public RetryMode getRetryMode() return retryMode; } - @JsonProperty - public List getUpdatedColumns() - { - return updatedColumns; - } - @JsonIgnore public boolean isRecordScannedFiles() { @@ -284,7 +271,6 @@ public IcebergTableHandle withProjectedColumns(Set projecte tableLocation, storageProperties, retryMode, - updatedColumns, recordScannedFiles, maxScannedFileSize); } @@ -307,30 +293,6 @@ public IcebergTableHandle withRetryMode(RetryMode retryMode) tableLocation, storageProperties, retryMode, - updatedColumns, - recordScannedFiles, - maxScannedFileSize); - } - - public IcebergTableHandle withUpdatedColumns(List updatedColumns) - { - return new IcebergTableHandle( - schemaName, - tableName, - tableType, - snapshotId, - tableSchemaJson, - sortOrder, - partitionSpecJson, - formatVersion, - unenforcedPredicate, - enforcedPredicate, - projectedColumns, - nameMappingJson, - tableLocation, - storageProperties, - retryMode, - updatedColumns, recordScannedFiles, maxScannedFileSize); } @@ -353,7 +315,6 @@ public IcebergTableHandle forOptimize(boolean recordScannedFiles, DataSize maxSc tableLocation, storageProperties, retryMode, - updatedColumns, recordScannedFiles, Optional.of(maxScannedFileSize)); } @@ -384,7 +345,6 @@ public boolean equals(Object o) Objects.equals(nameMappingJson, that.nameMappingJson) && Objects.equals(tableLocation, that.tableLocation) && Objects.equals(retryMode, that.retryMode) && - Objects.equals(updatedColumns, that.updatedColumns) && Objects.equals(storageProperties, that.storageProperties) && Objects.equals(maxScannedFileSize, that.maxScannedFileSize); } @@ -392,8 +352,24 @@ public boolean equals(Object o) @Override public int hashCode() { - return Objects.hash(schemaName, tableName, tableType, snapshotId, tableSchemaJson, sortOrder, partitionSpecJson, formatVersion, unenforcedPredicate, enforcedPredicate, - projectedColumns, nameMappingJson, tableLocation, storageProperties, retryMode, updatedColumns, recordScannedFiles, maxScannedFileSize); + return Objects.hash( + schemaName, + tableName, + tableType, + snapshotId, + tableSchemaJson, + sortOrder, + partitionSpecJson, + formatVersion, + unenforcedPredicate, + enforcedPredicate, + projectedColumns, + nameMappingJson, + tableLocation, + storageProperties, + retryMode, + recordScannedFiles, + maxScannedFileSize); } @Override 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 5d00d5437b8d..c325944dd0bd 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 @@ -190,7 +190,6 @@ private static ConnectorPageSource createTestingPageSource(HiveTransactionHandle tablePath, ImmutableMap.of(), RetryMode.NO_RETRIES, - ImmutableList.of(), false, Optional.empty()), transaction); 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 e99cb0c8a4a7..889b193d5e60 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 @@ -130,7 +130,6 @@ public void testIncompleteDynamicFilterTimeout() nationTable.location(), nationTable.properties(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); 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 56088a3642dc..c50a6bb24db2 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 @@ -169,7 +169,6 @@ public void testProjectionPushdown() "", ImmutableMap.of(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); TableHandle table = new TableHandle(catalogHandle, icebergTable, new HiveTransactionHandle(false)); @@ -252,7 +251,6 @@ public void testPredicatePushdown() "", ImmutableMap.of(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); TableHandle table = new TableHandle(catalogHandle, icebergTable, new HiveTransactionHandle(false)); @@ -302,7 +300,6 @@ public void testColumnPruningProjectionPushdown() "", ImmutableMap.of(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); TableHandle table = new TableHandle(catalogHandle, icebergTable, new HiveTransactionHandle(false)); @@ -363,7 +360,6 @@ public void testPushdownWithDuplicateExpressions() "", ImmutableMap.of(), NO_RETRIES, - ImmutableList.of(), false, Optional.empty()); TableHandle table = new TableHandle(catalogHandle, icebergTable, new HiveTransactionHandle(false));