From 31d33d25276198b047a0a929203225d099e3eece Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 12:21:59 +0530 Subject: [PATCH 01/12] Remove TableLayoutHandle for Tpch connector --- .../io/trino/cost/TestCostCalculator.java | 3 +- .../rule/TestPushPredicateIntoTableScan.java | 5 +- ...TestRemoveRedundantTableScanPredicate.java | 5 +- .../trino/plugin/tpch/TpchHandleResolver.java | 7 -- .../plugin/tpch/TpchTableLayoutHandle.java | 75 ------------------- 5 files changed, 5 insertions(+), 90 deletions(-) delete mode 100644 plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchTableLayoutHandle.java diff --git a/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java b/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java index 010ce456d02..93960964b94 100644 --- a/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java +++ b/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java @@ -26,7 +26,6 @@ import io.trino.plugin.tpch.TpchColumnHandle; import io.trino.plugin.tpch.TpchConnectorFactory; import io.trino.plugin.tpch.TpchTableHandle; -import io.trino.plugin.tpch.TpchTableLayoutHandle; import io.trino.security.AllowAllAccessControl; import io.trino.spi.connector.ColumnHandle; import io.trino.spi.predicate.TupleDomain; @@ -794,7 +793,7 @@ private TableScanNode tableScan(String id, String... symbols) TpchTableHandle tableHandle = new TpchTableHandle("sf1", "orders", 1.0); return new TableScanNode( new PlanNodeId(id), - new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE, Optional.of(new TpchTableLayoutHandle(tableHandle, TupleDomain.all()))), + new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE, Optional.empty()), symbolsList, assignments.build(), TupleDomain.all(), diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPushPredicateIntoTableScan.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPushPredicateIntoTableScan.java index 85fabc70b0f..04620ced134 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPushPredicateIntoTableScan.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPushPredicateIntoTableScan.java @@ -25,7 +25,6 @@ import io.trino.metadata.TestingFunctionResolution; import io.trino.plugin.tpch.TpchColumnHandle; import io.trino.plugin.tpch.TpchTableHandle; -import io.trino.plugin.tpch.TpchTableLayoutHandle; import io.trino.plugin.tpch.TpchTransactionHandle; import io.trino.spi.connector.ColumnHandle; import io.trino.spi.connector.ConnectorPartitioningHandle; @@ -104,14 +103,14 @@ public void setUpBeforeClass() catalogName, nation, TpchTransactionHandle.INSTANCE, - Optional.of(new TpchTableLayoutHandle(nation, TupleDomain.all()))); + Optional.empty()); TpchTableHandle orders = new TpchTableHandle("sf1", "orders", 1.0); ordersTableHandle = new TableHandle( catalogName, orders, TpchTransactionHandle.INSTANCE, - Optional.of(new TpchTableLayoutHandle(orders, TupleDomain.all()))); + Optional.empty()); } @Test diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java index 040a8e7d6bc..48bd821e400 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java @@ -19,7 +19,6 @@ import io.trino.metadata.TableHandle; import io.trino.plugin.tpch.TpchColumnHandle; import io.trino.plugin.tpch.TpchTableHandle; -import io.trino.plugin.tpch.TpchTableLayoutHandle; import io.trino.plugin.tpch.TpchTransactionHandle; import io.trino.spi.connector.ColumnHandle; import io.trino.spi.predicate.Domain; @@ -65,14 +64,14 @@ public void setUpBeforeClass() catalogName, nation, TpchTransactionHandle.INSTANCE, - Optional.of(new TpchTableLayoutHandle(nation, TupleDomain.all()))); + Optional.empty()); TpchTableHandle orders = new TpchTableHandle("sf1", "orders", 1.0); ordersTableHandle = new TableHandle( catalogName, orders, TpchTransactionHandle.INSTANCE, - Optional.of(new TpchTableLayoutHandle(orders, TupleDomain.all()))); + Optional.empty()); } @Test diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchHandleResolver.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchHandleResolver.java index 2eaffa0e31b..22ebdb5a4a7 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchHandleResolver.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchHandleResolver.java @@ -18,7 +18,6 @@ import io.trino.spi.connector.ConnectorPartitioningHandle; import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; public class TpchHandleResolver @@ -42,12 +41,6 @@ public Class getSplitClass() return TpchSplit.class; } - @Override - public Class getTableLayoutHandleClass() - { - return TpchTableLayoutHandle.class; - } - @Override public Class getTransactionHandleClass() { diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchTableLayoutHandle.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchTableLayoutHandle.java deleted file mode 100644 index 972ef15c5ee..00000000000 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchTableLayoutHandle.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.plugin.tpch; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.trino.spi.connector.ColumnHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; -import io.trino.spi.predicate.TupleDomain; - -import java.util.Objects; - -public class TpchTableLayoutHandle - implements ConnectorTableLayoutHandle -{ - private final TpchTableHandle table; - private final TupleDomain predicate; - - @JsonCreator - public TpchTableLayoutHandle(@JsonProperty("table") TpchTableHandle table, @JsonProperty("predicate") TupleDomain predicate) - { - this.table = table; - this.predicate = predicate; - } - - @JsonProperty - public TpchTableHandle getTable() - { - return table; - } - - @JsonProperty - public TupleDomain getPredicate() - { - return predicate; - } - - @Override - public String toString() - { - return table.toString(); - } - - @Override - public boolean equals(Object o) - { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - TpchTableLayoutHandle that = (TpchTableLayoutHandle) o; - return Objects.equals(table, that.table) && - Objects.equals(predicate, that.predicate); - } - - @Override - public int hashCode() - { - return Objects.hash(table, predicate); - } -} From 3fa9366ee30a16311f59d496766c84734d147c62 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 12:31:13 +0530 Subject: [PATCH 02/12] Remove usage of ConnectorTableLayoutHandle from SplitManager --- .../java/io/trino/split/SplitManager.java | 37 ++++--------------- .../io/trino/testing/LocalQueryRunner.java | 2 +- .../spi/connector/ConnectorMetadata.java | 1 - .../spi/connector/ConnectorSplitManager.java | 10 ----- .../ClassLoaderSafeConnectorSplitManager.java | 9 ----- 5 files changed, 9 insertions(+), 50 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/split/SplitManager.java b/core/trino-main/src/main/java/io/trino/split/SplitManager.java index ab5b9bb77ea..ba5f9cfa5dd 100644 --- a/core/trino-main/src/main/java/io/trino/split/SplitManager.java +++ b/core/trino-main/src/main/java/io/trino/split/SplitManager.java @@ -16,19 +16,16 @@ import io.trino.Session; import io.trino.connector.CatalogName; import io.trino.execution.QueryManagerConfig; -import io.trino.metadata.Metadata; import io.trino.metadata.TableHandle; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorSplitManager; import io.trino.spi.connector.ConnectorSplitManager.SplitSchedulingStrategy; import io.trino.spi.connector.ConnectorSplitSource; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.Constraint; import io.trino.spi.connector.DynamicFilter; import javax.inject.Inject; -import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -42,16 +39,10 @@ public class SplitManager private final ConcurrentMap splitManagers = new ConcurrentHashMap<>(); private final int minScheduleSplitBatchSize; - // NOTE: This only used for filling in the table layout if none is present by the time we - // get splits. DO NOT USE IT FOR ANY OTHER PURPOSE, as it will be removed once table layouts - // are gone entirely - private final Metadata metadata; - @Inject - public SplitManager(QueryManagerConfig config, Metadata metadata) + public SplitManager(QueryManagerConfig config) { this.minScheduleSplitBatchSize = config.getMinScheduleSplitBatchSize(); - this.metadata = metadata; } public void addConnectorSplitManager(CatalogName catalogName, ConnectorSplitManager connectorSplitManager) @@ -81,25 +72,13 @@ public SplitSource getSplits( ConnectorSession connectorSession = session.toConnectorSession(catalogName); - ConnectorSplitSource source; - if (metadata.usesLegacyTableLayouts(session, table)) { - ConnectorTableLayoutHandle layout = table.getLayout() - .orElseGet(() -> metadata.getLayout(session, table, Constraint.alwaysTrue(), Optional.empty()) - .get() - .getNewTableHandle() - .getLayout().get()); - - source = splitManager.getSplits(table.getTransaction(), connectorSession, layout, splitSchedulingStrategy); - } - else { - source = splitManager.getSplits( - table.getTransaction(), - connectorSession, - table.getConnectorHandle(), - splitSchedulingStrategy, - dynamicFilter, - constraint); - } + ConnectorSplitSource source = splitManager.getSplits( + table.getTransaction(), + connectorSession, + table.getConnectorHandle(), + splitSchedulingStrategy, + dynamicFilter, + constraint); SplitSource splitSource = new ConnectorAwareSplitSource(catalogName, source); if (minScheduleSplitBatchSize > 1) { diff --git a/core/trino-main/src/main/java/io/trino/testing/LocalQueryRunner.java b/core/trino-main/src/main/java/io/trino/testing/LocalQueryRunner.java index 1af16198edb..85c38e2c6d1 100644 --- a/core/trino-main/src/main/java/io/trino/testing/LocalQueryRunner.java +++ b/core/trino-main/src/main/java/io/trino/testing/LocalQueryRunner.java @@ -344,7 +344,7 @@ private LocalQueryRunner( blockEncodingSerde, nodeManager.getCurrentNode().getNodeVersion()); this.plannerContext = new PlannerContext(metadata, typeOperators, blockEncodingSerde, typeManager); - this.splitManager = new SplitManager(new QueryManagerConfig(), metadata); + this.splitManager = new SplitManager(new QueryManagerConfig()); this.planFragmenter = new PlanFragmenter(metadata, this.nodePartitioningManager, new QueryManagerConfig()); this.joinCompiler = new JoinCompiler(typeOperators); PageIndexerFactory pageIndexerFactory = new GroupByHashPageIndexerFactory(joinCompiler, blockTypeOperators); diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 6d9685f722f..10d1b8d0637 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -1022,7 +1022,6 @@ default List listTablePrivileges(ConnectorSession session, SchemaTabl *
    *
  • {@link #getTableProperties(ConnectorSession session, ConnectorTableHandle table)}
  • *
  • {@link #getInfo(ConnectorTableHandle table)}
  • - *
  • {@link ConnectorSplitManager#getSplits(ConnectorTransactionHandle, ConnectorSession, ConnectorTableHandle, ConnectorSplitManager.SplitSchedulingStrategy)}
  • *
*/ default boolean usesLegacyTableLayouts() diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorSplitManager.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorSplitManager.java index 9887b7debdf..27d45bd9966 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorSplitManager.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorSplitManager.java @@ -15,16 +15,6 @@ public interface ConnectorSplitManager { - @Deprecated - default ConnectorSplitSource getSplits( - ConnectorTransactionHandle transactionHandle, - ConnectorSession session, - ConnectorTableLayoutHandle layout, - SplitSchedulingStrategy splitSchedulingStrategy) - { - throw new UnsupportedOperationException(); - } - @Deprecated default ConnectorSplitSource getSplits( ConnectorTransactionHandle transaction, diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorSplitManager.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorSplitManager.java index f4728125134..bf3bee3ef63 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorSplitManager.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorSplitManager.java @@ -18,7 +18,6 @@ import io.trino.spi.connector.ConnectorSplitManager; import io.trino.spi.connector.ConnectorSplitSource; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; import io.trino.spi.connector.Constraint; import io.trino.spi.connector.DynamicFilter; @@ -40,14 +39,6 @@ public ClassLoaderSafeConnectorSplitManager(@ForClassLoaderSafe ConnectorSplitMa this.classLoader = requireNonNull(classLoader, "classLoader is null"); } - @Override - public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingStrategy splitSchedulingStrategy) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.getSplits(transactionHandle, session, layout, splitSchedulingStrategy); - } - } - @Override public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableHandle table, SplitSchedulingStrategy splitSchedulingStrategy, DynamicFilter dynamicFilter) { From 74a7a5ae73969d2b9ad0921bc5d990690e5660c6 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:06:34 +0530 Subject: [PATCH 03/12] Remove deprecated getInfo API involving LayoutHandle --- .../main/java/io/trino/metadata/MetadataManager.java | 11 ----------- .../io/trino/spi/connector/ConnectorMetadata.java | 12 ------------ .../ClassLoaderSafeConnectorMetadata.java | 8 -------- 3 files changed, 31 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index cc056829115..b0312ebcc0c 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -540,17 +540,6 @@ public Optional getInfo(Session session, TableHandle handle) CatalogName catalogName = handle.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (usesLegacyTableLayouts(session, handle)) { - ConnectorTableLayoutHandle layoutHandle = handle.getLayout() - .orElseGet(() -> getLayout(session, handle, Constraint.alwaysTrue(), Optional.empty()) - .get() - .getNewTableHandle() - .getLayout() - .get()); - - return metadata.getInfo(layoutHandle); - } - return metadata.getInfo(handle.getConnectorHandle()); } diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 10d1b8d0637..10fddd9cdca 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -247,17 +247,6 @@ default ConnectorTableMetadata getTableMetadata(ConnectorSession session, Connec throw new TrinoException(GENERIC_INTERNAL_ERROR, "ConnectorMetadata getTableHandle() is implemented without getTableMetadata()"); } - /** - * Return the connector-specific metadata for the specified table layout. This is the object that is passed to the event listener framework. - * - * @throws RuntimeException if table handle is no longer valid - */ - @Deprecated - default Optional getInfo(ConnectorTableLayoutHandle layoutHandle) - { - return Optional.empty(); - } - default Optional getInfo(ConnectorTableHandle table) { return Optional.empty(); @@ -1021,7 +1010,6 @@ default List listTablePrivileges(ConnectorSession session, SchemaTabl * connectors are required to implement the following methods: *
    *
  • {@link #getTableProperties(ConnectorSession session, ConnectorTableHandle table)}
  • - *
  • {@link #getInfo(ConnectorTableHandle table)}
  • *
*/ default boolean usesLegacyTableLayouts() diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index ca713cecdc4..06d13078259 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -286,14 +286,6 @@ public ConnectorTableMetadata getTableMetadata(ConnectorSession session, Connect } } - @Override - public Optional getInfo(ConnectorTableLayoutHandle table) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.getInfo(table); - } - } - @Override public Optional getInfo(ConnectorTableHandle table) { From 5a649174ec3301edb3867cedcdc6600ee7b46541 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:07:44 +0530 Subject: [PATCH 04/12] Remove ConnectorMetadata#getTableLayout --- .../io/trino/metadata/MetadataManager.java | 8 ----- .../spi/connector/ConnectorMetadata.java | 29 ++----------------- .../ClassLoaderSafeConnectorMetadata.java | 9 ------ 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index b0312ebcc0c..eeea31019c6 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -484,14 +484,6 @@ public TableProperties getTableProperties(Session session, TableHandle handle) ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName); ConnectorSession connectorSession = session.toConnectorSession(catalogName); - if (metadata.usesLegacyTableLayouts()) { - return handle.getLayout() - .map(layout -> new TableProperties(catalogName, handle.getTransaction(), new ConnectorTableProperties(metadata.getTableLayout(connectorSession, layout)))) - .orElseGet(() -> getLayout(session, handle, Constraint.alwaysTrue(), Optional.empty()) - .get() - .getTableProperties()); - } - return new TableProperties(catalogName, handle.getTransaction(), metadata.getTableProperties(connectorSession, handle.getConnectorHandle())); } diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 10fddd9cdca..8a2e0d70b23 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -43,7 +43,6 @@ import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR; import static io.trino.spi.StandardErrorCode.NOT_SUPPORTED; -import static java.lang.String.format; import static java.util.Collections.emptyList; import static java.util.Collections.emptyMap; import static java.util.stream.Collectors.toUnmodifiableList; @@ -178,16 +177,6 @@ default List getTableLayouts( throw new UnsupportedOperationException("Not yet implemented"); } - @Deprecated - default ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) - { - if (usesLegacyTableLayouts()) { - throw new IllegalStateException("Connector uses legacy Table Layout but doesn't implement getTableLayout()"); - } - - throw new UnsupportedOperationException("Not yet implemented"); - } - /** * Return a table layout handle whose partitioning is converted to the provided partitioning handle, * but otherwise identical to the provided table layout handle. @@ -1006,11 +995,7 @@ default List listTablePrivileges(ConnectorSession session, SchemaTabl } /** - * Whether the connector uses the legacy Table Layout feature. If this method returns false, - * connectors are required to implement the following methods: - *
    - *
  • {@link #getTableProperties(ConnectorSession session, ConnectorTableHandle table)}
  • - *
+ * Whether the connector uses the legacy Table Layout feature. */ default boolean usesLegacyTableLayouts() { @@ -1019,17 +1004,7 @@ default boolean usesLegacyTableLayouts() default ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { - if (!usesLegacyTableLayouts()) { - throw new IllegalStateException("getTableProperties() must be implemented if usesLegacyTableLayouts is false"); - } - - List layouts = getTableLayouts(session, table, Constraint.alwaysTrue(), Optional.empty()); - - if (layouts.size() != 1) { - throw new TrinoException(NOT_SUPPORTED, format("Connector must return a single layout for table %s, but got %s", table, layouts.size())); - } - - return new ConnectorTableProperties(layouts.get(0).getTableLayout()); + return new ConnectorTableProperties(); } /** diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index 06d13078259..860c9e207f7 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -33,7 +33,6 @@ import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayout; import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTableLayoutResult; import io.trino.spi.connector.ConnectorTableMetadata; @@ -110,14 +109,6 @@ public List getTableLayouts( } } - @Override - public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.getTableLayout(session, handle); - } - } - @Override public Optional getCommonPartitioningHandle(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right) { From e743e1f681d0314a374a5454aa3e9008d4d6cc56 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:20:21 +0530 Subject: [PATCH 05/12] Remove deprecated makeCompatiblePartitioning API involving LayoutHandle --- .../java/io/trino/metadata/MetadataManager.java | 6 +----- .../io/trino/spi/connector/ConnectorMetadata.java | 15 --------------- .../ClassLoaderSafeConnectorMetadata.java | 8 -------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index eeea31019c6..22636e2bc26 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -56,7 +56,6 @@ import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; import io.trino.spi.connector.ConnectorTableLayout; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTableLayoutResult; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTableProperties; @@ -496,10 +495,7 @@ public TableHandle makeCompatiblePartitioning(Session session, TableHandle table CatalogMetadata catalogMetadata = getCatalogMetadata(session, catalogName); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName); ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(catalogName); - if (metadata.usesLegacyTableLayouts()) { - ConnectorTableLayoutHandle newTableLayoutHandle = metadata.makeCompatiblePartitioning(session.toConnectorSession(catalogName), tableHandle.getLayout().get(), partitioningHandle.getConnectorHandle()); - return new TableHandle(catalogName, tableHandle.getConnectorHandle(), transaction, Optional.of(newTableLayoutHandle)); - } + verify(tableHandle.getLayout().isEmpty(), "layout should not be present"); ConnectorTableHandle newTableHandle = metadata.makeCompatiblePartitioning( session.toConnectorSession(catalogName), diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 8a2e0d70b23..31f19af6474 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -177,21 +177,6 @@ default List getTableLayouts( throw new UnsupportedOperationException("Not yet implemented"); } - /** - * Return a table layout handle whose partitioning is converted to the provided partitioning handle, - * but otherwise identical to the provided table layout handle. - * The provided table layout handle must be one that the connector can transparently convert to from - * the original partitioning handle associated with the provided table layout handle, - * as promised by {@link #getCommonPartitioningHandle}. - * - * @deprecated use the version without layouts - */ - @Deprecated - default ConnectorTableLayoutHandle makeCompatiblePartitioning(ConnectorSession session, ConnectorTableLayoutHandle tableLayoutHandle, ConnectorPartitioningHandle partitioningHandle) - { - throw new TrinoException(GENERIC_INTERNAL_ERROR, "ConnectorMetadata getCommonPartitioningHandle() is implemented without makeCompatiblePartitioning()"); - } - /** * Return a table handle whose partitioning is converted to the provided partitioning handle, * but otherwise identical to the provided table handle. diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index 860c9e207f7..e527a919cc3 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -117,14 +117,6 @@ public Optional getCommonPartitioningHandle(Connect } } - @Override - public ConnectorTableLayoutHandle makeCompatiblePartitioning(ConnectorSession session, ConnectorTableLayoutHandle tableLayoutHandle, ConnectorPartitioningHandle partitioningHandle) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.makeCompatiblePartitioning(session, tableLayoutHandle, partitioningHandle); - } - } - @Override public ConnectorTableHandle makeCompatiblePartitioning(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorPartitioningHandle partitioningHandle) { From c4e37b78fa8d4f872429d1daa8153f80d77f21a5 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:11:57 +0530 Subject: [PATCH 06/12] Move computeEnforced to PushPredicateIntoTableScan --- .../io/trino/metadata/TableLayoutResult.java | 55 ------------------- .../rule/PushPredicateIntoTableScan.java | 54 +++++++++++++++++- .../trino/metadata/TestTableLayoutResult.java | 2 +- 3 files changed, 54 insertions(+), 57 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java b/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java index f790a1f2dbd..ad7501c2840 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java +++ b/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java @@ -13,14 +13,9 @@ */ package io.trino.metadata; -import com.google.common.collect.ImmutableMap; import io.trino.spi.connector.ColumnHandle; -import io.trino.spi.predicate.Domain; import io.trino.spi.predicate.TupleDomain; -import java.util.Map; - -import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; @Deprecated @@ -51,54 +46,4 @@ public TupleDomain getUnenforcedConstraint() { return unenforcedConstraint; } - - public static TupleDomain computeEnforced(TupleDomain predicate, TupleDomain unenforced) - { - if (predicate.isNone()) { - // If the engine requests that the connector provides a layout with a domain of "none". The connector can have two possible reactions, either: - // 1. The connector can provide an empty table layout. - // * There would be no unenforced predicate, i.e., unenforced predicate is TupleDomain.all(). - // * The predicate was successfully enforced. Enforced predicate would be same as predicate: TupleDomain.none(). - // 2. The connector can't/won't. - // * The connector would tell the engine to put a filter on top of the scan, i.e., unenforced predicate is TupleDomain.none(). - // * The connector didn't successfully enforce anything. Therefore, enforced predicate would be TupleDomain.all(). - if (unenforced.isNone()) { - return TupleDomain.all(); - } - if (unenforced.isAll()) { - return TupleDomain.none(); - } - throw new IllegalArgumentException(); - } - - // The engine requested the connector provides a layout with a non-none TupleDomain. - // A TupleDomain is effectively a list of column-Domain pairs. - // The connector is expected enforce the respective domain entirely on none, some, or all of the columns. - // 1. When the connector could enforce none of the domains, the unenforced would be equal to predicate; - // 2. When the connector could enforce some of the domains, the unenforced would contain a subset of the column-Domain pairs; - // 3. When the connector could enforce all of the domains, the unenforced would be TupleDomain.all(). - - // In all 3 cases shown above, the unenforced is not TupleDomain.none(). - checkArgument(!unenforced.isNone()); - - Map predicateDomains = predicate.getDomains().get(); - Map unenforcedDomains = unenforced.getDomains().get(); - ImmutableMap.Builder enforcedDomainsBuilder = ImmutableMap.builder(); - for (Map.Entry entry : predicateDomains.entrySet()) { - ColumnHandle predicateColumnHandle = entry.getKey(); - if (unenforcedDomains.containsKey(predicateColumnHandle)) { - checkArgument( - entry.getValue().equals(unenforcedDomains.get(predicateColumnHandle)), - "Enforced tuple domain cannot be determined. The connector is expected to enforce the respective domain entirely on none, some, or all of the column."); - } - else { - enforcedDomainsBuilder.put(predicateColumnHandle, entry.getValue()); - } - } - Map enforcedDomains = enforcedDomainsBuilder.build(); - checkArgument( - enforcedDomains.size() + unenforcedDomains.size() == predicateDomains.size(), - "Enforced tuple domain cannot be determined. Connector returned an unenforced TupleDomain that contains columns not in predicate."); - return TupleDomain.withColumnDomains(enforcedDomains); - } } diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java b/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java index 08d39e09999..c509f961360 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java @@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import io.trino.Session; import io.trino.cost.StatsProvider; import io.trino.matching.Capture; @@ -28,6 +29,7 @@ import io.trino.spi.connector.ColumnHandle; import io.trino.spi.connector.Constraint; import io.trino.spi.connector.ConstraintApplicationResult; +import io.trino.spi.predicate.Domain; import io.trino.spi.predicate.TupleDomain; import io.trino.sql.PlannerContext; import io.trino.sql.planner.DomainTranslator; @@ -46,11 +48,11 @@ import java.util.Objects; import java.util.Optional; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Verify.verify; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static io.trino.SystemSessionProperties.isAllowPushdownIntoConnectors; import static io.trino.matching.Capture.newCapture; -import static io.trino.metadata.TableLayoutResult.computeEnforced; import static io.trino.sql.ExpressionUtils.combineConjuncts; import static io.trino.sql.ExpressionUtils.filterDeterministicConjuncts; import static io.trino.sql.ExpressionUtils.filterNonDeterministicConjuncts; @@ -332,4 +334,54 @@ static Expression createResultingPredicate( return expression; } + + public static TupleDomain computeEnforced(TupleDomain predicate, TupleDomain unenforced) + { + if (predicate.isNone()) { + // If the engine requests that the connector provides a layout with a domain of "none". The connector can have two possible reactions, either: + // 1. The connector can provide an empty table layout. + // * There would be no unenforced predicate, i.e., unenforced predicate is TupleDomain.all(). + // * The predicate was successfully enforced. Enforced predicate would be same as predicate: TupleDomain.none(). + // 2. The connector can't/won't. + // * The connector would tell the engine to put a filter on top of the scan, i.e., unenforced predicate is TupleDomain.none(). + // * The connector didn't successfully enforce anything. Therefore, enforced predicate would be TupleDomain.all(). + if (unenforced.isNone()) { + return TupleDomain.all(); + } + if (unenforced.isAll()) { + return TupleDomain.none(); + } + throw new IllegalArgumentException(); + } + + // The engine requested the connector provides a layout with a non-none TupleDomain. + // A TupleDomain is effectively a list of column-Domain pairs. + // The connector is expected enforce the respective domain entirely on none, some, or all of the columns. + // 1. When the connector could enforce none of the domains, the unenforced would be equal to predicate; + // 2. When the connector could enforce some of the domains, the unenforced would contain a subset of the column-Domain pairs; + // 3. When the connector could enforce all of the domains, the unenforced would be TupleDomain.all(). + + // In all 3 cases shown above, the unenforced is not TupleDomain.none(). + checkArgument(!unenforced.isNone()); + + Map predicateDomains = predicate.getDomains().get(); + Map unenforcedDomains = unenforced.getDomains().get(); + ImmutableMap.Builder enforcedDomainsBuilder = ImmutableMap.builder(); + for (Map.Entry entry : predicateDomains.entrySet()) { + ColumnHandle predicateColumnHandle = entry.getKey(); + if (unenforcedDomains.containsKey(predicateColumnHandle)) { + checkArgument( + entry.getValue().equals(unenforcedDomains.get(predicateColumnHandle)), + "Enforced tuple domain cannot be determined. The connector is expected to enforce the respective domain entirely on none, some, or all of the column."); + } + else { + enforcedDomainsBuilder.put(predicateColumnHandle, entry.getValue()); + } + } + Map enforcedDomains = enforcedDomainsBuilder.build(); + checkArgument( + enforcedDomains.size() + unenforcedDomains.size() == predicateDomains.size(), + "Enforced tuple domain cannot be determined. Connector returned an unenforced TupleDomain that contains columns not in predicate."); + return TupleDomain.withColumnDomains(enforcedDomains); + } } diff --git a/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java b/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java index 15022aea9aa..516700c34e6 100644 --- a/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java +++ b/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java @@ -21,8 +21,8 @@ import io.trino.spi.predicate.TupleDomain; import org.testng.annotations.Test; -import static io.trino.metadata.TableLayoutResult.computeEnforced; import static io.trino.spi.type.BigintType.BIGINT; +import static io.trino.sql.planner.iterative.rule.PushPredicateIntoTableScan.computeEnforced; import static io.trino.testing.TestingConnectorSession.SESSION; import static java.lang.String.format; import static org.testng.Assert.fail; From 39453cea7a0e4d596fe22a97e9adc326d01ab851 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:16:44 +0530 Subject: [PATCH 07/12] Remove TableLayout objects --- .../main/java/io/trino/metadata/Metadata.java | 6 - .../io/trino/metadata/MetadataManager.java | 42 ----- .../io/trino/metadata/TableLayoutResult.java | 49 ------ .../rule/PushPredicateIntoTableScan.java | 109 ++++-------- .../trino/metadata/AbstractMockMetadata.java | 12 -- .../trino/metadata/TestTableLayoutResult.java | 119 ------------- .../spi/connector/ConnectorMetadata.java | 23 +-- .../spi/connector/ConnectorTableLayout.java | 166 ------------------ .../connector/ConnectorTableLayoutResult.java | 40 ----- .../connector/ConnectorTableProperties.java | 10 -- .../ClassLoaderSafeConnectorMetadata.java | 13 -- 11 files changed, 34 insertions(+), 555 deletions(-) delete mode 100644 core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java delete mode 100644 core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java delete mode 100644 core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayout.java delete mode 100644 core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutResult.java diff --git a/core/trino-main/src/main/java/io/trino/metadata/Metadata.java b/core/trino-main/src/main/java/io/trino/metadata/Metadata.java index 6315468a251..061ec1aeafb 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/Metadata.java +++ b/core/trino-main/src/main/java/io/trino/metadata/Metadata.java @@ -103,9 +103,6 @@ Optional getTableHandleForExecute( void finishTableExecute(Session session, TableExecuteHandle handle, Collection fragments, List tableExecuteState); - @Deprecated - Optional getLayout(Session session, TableHandle tableHandle, Constraint constraint, Optional> desiredColumns); - TableProperties getTableProperties(Session session, TableHandle handle); /** @@ -449,9 +446,6 @@ default boolean isView(Session session, QualifiedObjectName viewName) */ Optional resolveIndex(Session session, TableHandle tableHandle, Set indexableColumns, Set outputColumns, TupleDomain tupleDomain); - @Deprecated - boolean usesLegacyTableLayouts(Session session, TableHandle table); - Optional> applyLimit(Session session, TableHandle table, long limit); Optional> applyFilter(Session session, TableHandle table, Constraint constraint); diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index 22636e2bc26..f8cbbe729f7 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -55,10 +55,7 @@ import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayout; -import io.trino.spi.connector.ConnectorTableLayoutResult; import io.trino.spi.connector.ConnectorTableMetadata; -import io.trino.spi.connector.ConnectorTableProperties; import io.trino.spi.connector.ConnectorTableSchema; import io.trino.spi.connector.ConnectorTableVersion; import io.trino.spi.connector.ConnectorTransactionHandle; @@ -442,39 +439,6 @@ public Optional getSystemTable(Session session, QualifiedObjectName return Optional.empty(); } - @Override - public Optional getLayout(Session session, TableHandle table, Constraint constraint, Optional> desiredColumns) - { - if (constraint.getSummary().isNone()) { - return Optional.empty(); - } - - CatalogName catalogName = table.getCatalogName(); - ConnectorTableHandle connectorTable = table.getConnectorHandle(); - - CatalogMetadata catalogMetadata = getCatalogMetadata(session, catalogName); - ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName); - - checkState(metadata.usesLegacyTableLayouts(), "getLayout() was called even though connector doesn't support legacy Table Layout"); - - ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(catalogName); - ConnectorSession connectorSession = session.toConnectorSession(catalogName); - List layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns); - if (layouts.isEmpty()) { - return Optional.empty(); - } - - if (layouts.size() > 1) { - throw new TrinoException(NOT_SUPPORTED, format("Connector returned multiple layouts for table %s", table)); - } - - ConnectorTableLayout tableLayout = layouts.get(0).getTableLayout(); - return Optional.of(new TableLayoutResult( - new TableHandle(catalogName, connectorTable, transaction, Optional.of(tableLayout.getHandle())), - new TableProperties(catalogName, transaction, new ConnectorTableProperties(tableLayout)), - layouts.get(0).getUnenforcedConstraint())); - } - @Override public TableProperties getTableProperties(Session session, TableHandle handle) { @@ -1608,12 +1572,6 @@ public Optional resolveIndex(Session session, TableHandle tableHa return resolvedIndex.map(resolved -> new ResolvedIndex(tableHandle.getCatalogName(), transaction, resolved)); } - @Override - public boolean usesLegacyTableLayouts(Session session, TableHandle table) - { - return getMetadata(session, table.getCatalogName()).usesLegacyTableLayouts(); - } - @Override public Optional> applyLimit(Session session, TableHandle table, long limit) { diff --git a/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java b/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java deleted file mode 100644 index ad7501c2840..00000000000 --- a/core/trino-main/src/main/java/io/trino/metadata/TableLayoutResult.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.metadata; - -import io.trino.spi.connector.ColumnHandle; -import io.trino.spi.predicate.TupleDomain; - -import static java.util.Objects.requireNonNull; - -@Deprecated -public class TableLayoutResult -{ - private final TableHandle newTableHandle; - private final TableProperties layout; - private final TupleDomain unenforcedConstraint; - - public TableLayoutResult(TableHandle newTable, TableProperties layout, TupleDomain unenforcedConstraint) - { - this.newTableHandle = requireNonNull(newTable, "newTable is null"); - this.layout = requireNonNull(layout, "layout is null"); - this.unenforcedConstraint = requireNonNull(unenforcedConstraint, "unenforcedConstraint is null"); - } - - public TableHandle getNewTableHandle() - { - return newTableHandle; - } - - public TableProperties getTableProperties() - { - return layout; - } - - public TupleDomain getUnenforcedConstraint() - { - return unenforcedConstraint; - } -} diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java b/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java index c509f961360..63fb9eb8dda 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/PushPredicateIntoTableScan.java @@ -23,7 +23,6 @@ import io.trino.matching.Pattern; import io.trino.metadata.Metadata; import io.trino.metadata.TableHandle; -import io.trino.metadata.TableLayoutResult; import io.trino.metadata.TableProperties; import io.trino.metadata.TableProperties.TablePartitioning; import io.trino.spi.connector.ColumnHandle; @@ -50,7 +49,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Verify.verify; -import static com.google.common.collect.ImmutableSet.toImmutableSet; import static io.trino.SystemSessionProperties.isAllowPushdownIntoConnectors; import static io.trino.matching.Capture.newCapture; import static io.trino.sql.ExpressionUtils.combineConjuncts; @@ -196,72 +194,48 @@ public static Optional pushFilterIntoTableScan( constraint = new Constraint(newDomain); } - TableHandle newTable; - Optional newTablePartitioning; - TupleDomain remainingFilter; - boolean precalculateStatistics; - if (!plannerContext.getMetadata().usesLegacyTableLayouts(session, node.getTable())) { - // check if new domain is wider than domain already provided by table scan - if (constraint.predicate().isEmpty() && newDomain.contains(node.getEnforcedConstraint())) { - Expression resultingPredicate = createResultingPredicate( - plannerContext, - session, - symbolAllocator, - typeAnalyzer, - TRUE_LITERAL, - nonDeterministicPredicate, - decomposedPredicate.getRemainingExpression()); - - if (!TRUE_LITERAL.equals(resultingPredicate)) { - return Optional.of(new FilterNode(filterNode.getId(), node, resultingPredicate)); - } - - return Optional.of(node); - } + // check if new domain is wider than domain already provided by table scan + if (constraint.predicate().isEmpty() && newDomain.contains(node.getEnforcedConstraint())) { + Expression resultingPredicate = createResultingPredicate( + plannerContext, + session, + symbolAllocator, + typeAnalyzer, + TRUE_LITERAL, + nonDeterministicPredicate, + decomposedPredicate.getRemainingExpression()); - if (newDomain.isNone()) { - // TODO: DomainTranslator.fromPredicate can infer that the expression is "false" in some cases (TupleDomain.none()). - // This should move to another rule that simplifies the filter using that logic and then rely on RemoveTrivialFilters - // to turn the subtree into a Values node - return Optional.of(new ValuesNode(node.getId(), node.getOutputSymbols(), ImmutableList.of())); + if (!TRUE_LITERAL.equals(resultingPredicate)) { + return Optional.of(new FilterNode(filterNode.getId(), node, resultingPredicate)); } - Optional> result = plannerContext.getMetadata().applyFilter(session, node.getTable(), constraint); - - if (result.isEmpty()) { - return Optional.empty(); - } + return Optional.of(node); + } - newTable = result.get().getHandle(); + if (newDomain.isNone()) { + // TODO: DomainTranslator.fromPredicate can infer that the expression is "false" in some cases (TupleDomain.none()). + // This should move to another rule that simplifies the filter using that logic and then rely on RemoveTrivialFilters + // to turn the subtree into a Values node + return Optional.of(new ValuesNode(node.getId(), node.getOutputSymbols(), ImmutableList.of())); + } - TableProperties newTableProperties = plannerContext.getMetadata().getTableProperties(session, newTable); - newTablePartitioning = newTableProperties.getTablePartitioning(); - if (newTableProperties.getPredicate().isNone()) { - return Optional.of(new ValuesNode(node.getId(), node.getOutputSymbols(), ImmutableList.of())); - } + Optional> result = plannerContext.getMetadata().applyFilter(session, node.getTable(), constraint); - remainingFilter = result.get().getRemainingFilter(); - precalculateStatistics = result.get().isPrecalculateStatistics(); + if (result.isEmpty()) { + return Optional.empty(); } - else { - Optional layout = plannerContext.getMetadata().getLayout( - session, - node.getTable(), - constraint, - Optional.of(node.getOutputSymbols().stream() - .map(node.getAssignments()::get) - .collect(toImmutableSet()))); - - if (layout.isEmpty() || layout.get().getTableProperties().getPredicate().isNone()) { - return Optional.of(new ValuesNode(node.getId(), node.getOutputSymbols(), ImmutableList.of())); - } - newTable = layout.get().getNewTableHandle(); - newTablePartitioning = layout.get().getTableProperties().getTablePartitioning(); - remainingFilter = layout.get().getUnenforcedConstraint(); - precalculateStatistics = false; + TableHandle newTable = result.get().getHandle(); + + TableProperties newTableProperties = plannerContext.getMetadata().getTableProperties(session, newTable); + Optional newTablePartitioning = newTableProperties.getTablePartitioning(); + if (newTableProperties.getPredicate().isNone()) { + return Optional.of(new ValuesNode(node.getId(), node.getOutputSymbols(), ImmutableList.of())); } + TupleDomain remainingFilter = result.get().getRemainingFilter(); + boolean precalculateStatistics = result.get().isPrecalculateStatistics(); + verifyTablePartitioning(session, plannerContext.getMetadata(), node, newTablePartitioning); TableScanNode tableScan = new TableScanNode( @@ -337,24 +311,7 @@ static Expression createResultingPredicate( public static TupleDomain computeEnforced(TupleDomain predicate, TupleDomain unenforced) { - if (predicate.isNone()) { - // If the engine requests that the connector provides a layout with a domain of "none". The connector can have two possible reactions, either: - // 1. The connector can provide an empty table layout. - // * There would be no unenforced predicate, i.e., unenforced predicate is TupleDomain.all(). - // * The predicate was successfully enforced. Enforced predicate would be same as predicate: TupleDomain.none(). - // 2. The connector can't/won't. - // * The connector would tell the engine to put a filter on top of the scan, i.e., unenforced predicate is TupleDomain.none(). - // * The connector didn't successfully enforce anything. Therefore, enforced predicate would be TupleDomain.all(). - if (unenforced.isNone()) { - return TupleDomain.all(); - } - if (unenforced.isAll()) { - return TupleDomain.none(); - } - throw new IllegalArgumentException(); - } - - // The engine requested the connector provides a layout with a non-none TupleDomain. + // The engine requested the connector to apply a filter with a non-none TupleDomain. // A TupleDomain is effectively a list of column-Domain pairs. // The connector is expected enforce the respective domain entirely on none, some, or all of the columns. // 1. When the connector could enforce none of the domains, the unenforced would be equal to predicate; diff --git a/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java b/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java index c2a8c0b2d08..ba280667f28 100644 --- a/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java +++ b/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java @@ -158,12 +158,6 @@ public Optional getSystemTable(Session session, QualifiedObjectName throw new UnsupportedOperationException(); } - @Override - public Optional getLayout(Session session, TableHandle tableHandle, Constraint constraint, Optional> desiredColumns) - { - throw new UnsupportedOperationException(); - } - @Override public TableProperties getTableProperties(Session session, TableHandle handle) { @@ -548,12 +542,6 @@ public Optional resolveIndex(Session session, TableHandle tableHa throw new UnsupportedOperationException(); } - @Override - public boolean usesLegacyTableLayouts(Session session, TableHandle table) - { - throw new UnsupportedOperationException(); - } - @Override public Optional> applyLimit(Session session, TableHandle table, long limit) { diff --git a/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java b/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java deleted file mode 100644 index 516700c34e6..00000000000 --- a/core/trino-main/src/test/java/io/trino/metadata/TestTableLayoutResult.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.trino.metadata; - -import com.google.common.collect.ImmutableMap; -import io.trino.spi.connector.ColumnHandle; -import io.trino.spi.connector.TestingColumnHandle; -import io.trino.spi.predicate.Domain; -import io.trino.spi.predicate.TupleDomain; -import org.testng.annotations.Test; - -import static io.trino.spi.type.BigintType.BIGINT; -import static io.trino.sql.planner.iterative.rule.PushPredicateIntoTableScan.computeEnforced; -import static io.trino.testing.TestingConnectorSession.SESSION; -import static java.lang.String.format; -import static org.testng.Assert.fail; - -public class TestTableLayoutResult -{ - @Test - public void testComputeEnforced() - { - assertComputeEnforced(TupleDomain.all(), TupleDomain.all(), TupleDomain.all()); - assertComputeEnforcedFails(TupleDomain.all(), TupleDomain.none()); - assertComputeEnforced(TupleDomain.none(), TupleDomain.all(), TupleDomain.none()); - assertComputeEnforced(TupleDomain.none(), TupleDomain.none(), TupleDomain.all()); - - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.all(), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L)))); - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.all()); - assertComputeEnforcedFails( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.none()); - assertComputeEnforcedFails( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 9999L)))); - assertComputeEnforcedFails( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c9999"), Domain.singleValue(BIGINT, 1L)))); - - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.all(), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L)))); - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L)))); - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L)))); - assertComputeEnforced( - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.withColumnDomains(ImmutableMap.of( - new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), - new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), - TupleDomain.all()); - } - - private void assertComputeEnforcedFails(TupleDomain predicate, TupleDomain unenforced) - { - try { - TupleDomain enforced = computeEnforced(predicate, unenforced); - fail(format("expected IllegalArgumentException but found [%s]", enforced.toString(SESSION))); - } - catch (IllegalArgumentException e) { - // do nothing - } - } - - private void assertComputeEnforced(TupleDomain predicate, TupleDomain unenforced, TupleDomain expectedEnforced) - { - TupleDomain enforced = computeEnforced(predicate, unenforced); - if (!enforced.equals(expectedEnforced)) { - fail(format("expected [%s] but found [%s]", expectedEnforced.toString(SESSION), enforced.toString(SESSION))); - } - } -} diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 31f19af6474..ddf2c059d10 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -158,25 +158,6 @@ default Optional getSystemTable(ConnectorSession session, SchemaTab return Optional.empty(); } - /** - * Return a list of table layouts that satisfy the given constraint. - *

- * For each layout, connectors must return an "unenforced constraint" representing the part of the constraint summary that isn't guaranteed by the layout. - */ - @Deprecated - default List getTableLayouts( - ConnectorSession session, - ConnectorTableHandle table, - Constraint constraint, - Optional> desiredColumns) - { - if (usesLegacyTableLayouts()) { - throw new IllegalStateException("Connector uses legacy Table Layout but doesn't implement getTableLayouts()"); - } - - throw new UnsupportedOperationException("Not yet implemented"); - } - /** * Return a table handle whose partitioning is converted to the provided partitioning handle, * but otherwise identical to the provided table handle. @@ -1017,9 +998,7 @@ default Optional> applyLimit(Connec } /** - * Attempt to push down the provided constraint into the table. This method is provided as replacement to - * {@link ConnectorMetadata#getTableLayouts(ConnectorSession, ConnectorTableHandle, Constraint, Optional)} to ease - * migration for the legacy API. + * Attempt to push down the provided constraint into the table. *

* Connectors can indicate whether they don't support predicate pushdown or that the action had no effect * by returning {@link Optional#empty()}. Connectors should expect this method to be called multiple times diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayout.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayout.java deleted file mode 100644 index a91b996ba99..00000000000 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayout.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.spi.connector; - -import io.trino.spi.predicate.TupleDomain; - -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -import static java.util.Collections.emptyList; -import static java.util.Objects.requireNonNull; - -@Deprecated -public class ConnectorTableLayout -{ - private final ConnectorTableLayoutHandle handle; - private final Optional> columns; - private final TupleDomain predicate; - private final Optional tablePartitioning; - private final Optional> streamPartitioningColumns; - private final Optional discretePredicates; - private final List> localProperties; - - public ConnectorTableLayout(ConnectorTableLayoutHandle handle) - { - this(handle, - Optional.empty(), - TupleDomain.all(), - Optional.empty(), - Optional.empty(), - Optional.empty(), - emptyList()); - } - - public ConnectorTableLayout( - ConnectorTableLayoutHandle handle, - Optional> columns, - TupleDomain predicate, - Optional tablePartitioning, - Optional> streamPartitioningColumns, - Optional discretePredicates, - List> localProperties) - { - requireNonNull(handle, "handle is null"); - requireNonNull(columns, "columns is null"); - requireNonNull(streamPartitioningColumns, "streamPartitioningColumns is null"); - requireNonNull(tablePartitioning, "tablePartitioning is null"); - requireNonNull(predicate, "predicate is null"); - requireNonNull(discretePredicates, "discretePredicates is null"); - requireNonNull(localProperties, "localProperties is null"); - - this.handle = handle; - this.columns = columns; - this.tablePartitioning = tablePartitioning; - this.streamPartitioningColumns = streamPartitioningColumns; - this.predicate = predicate; - this.discretePredicates = discretePredicates; - this.localProperties = localProperties; - } - - public ConnectorTableLayoutHandle getHandle() - { - return handle; - } - - /** - * The columns from the original table provided by this layout. A layout may provide only a subset of columns. - */ - public Optional> getColumns() - { - return columns; - } - - /** - * A TupleDomain that represents a predicate that every row this TableScan node - * produces is guaranteed to satisfy. - *

- * This guarantee can have different origins. - * For example, it may be successful predicate push down, or inherent guarantee provided by the underlying data. - */ - public TupleDomain getPredicate() - { - return predicate; - } - - /** - * The partitioning of the table across the worker nodes. - *

- * If the table is node partitioned, the connector guarantees that each combination of values for - * the distributed columns will be contained within a single worker. - */ - public Optional getTablePartitioning() - { - return tablePartitioning; - } - - /** - * The partitioning for the table streams. - * If empty, the table layout is partitioned arbitrarily. - * Otherwise, table steams are partitioned on the given set of columns (or unpartitioned, if the set is empty) - *

- * If the table is partitioned, the connector guarantees that each combination of values for - * the partition columns will be contained within a single split (i.e., partitions cannot - * straddle multiple splits) - */ - public Optional> getStreamPartitioningColumns() - { - return streamPartitioningColumns; - } - - /** - * A collection of discrete predicates describing the data in this layout. The union of - * these predicates is expected to be equivalent to the overall predicate returned - * by {@link #getPredicate()}. They may be used by the engine for further optimizations. - */ - public Optional getDiscretePredicates() - { - return discretePredicates; - } - - /** - * Properties describing the layout of the data (grouping/sorting) within each partition - */ - public List> getLocalProperties() - { - return localProperties; - } - - @Override - public int hashCode() - { - return Objects.hash(handle, columns, predicate, discretePredicates, streamPartitioningColumns, tablePartitioning, localProperties); - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - ConnectorTableLayout other = (ConnectorTableLayout) obj; - return Objects.equals(this.handle, other.handle) - && Objects.equals(this.columns, other.columns) - && Objects.equals(this.predicate, other.predicate) - && Objects.equals(this.discretePredicates, other.discretePredicates) - && Objects.equals(this.streamPartitioningColumns, other.streamPartitioningColumns) - && Objects.equals(this.tablePartitioning, other.tablePartitioning) - && Objects.equals(this.localProperties, other.localProperties); - } -} diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutResult.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutResult.java deleted file mode 100644 index 5a307e6ca02..00000000000 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutResult.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.spi.connector; - -import io.trino.spi.predicate.TupleDomain; - -import static java.util.Objects.requireNonNull; - -public class ConnectorTableLayoutResult -{ - private final ConnectorTableLayout layout; - private final TupleDomain unenforcedConstraint; - - public ConnectorTableLayoutResult(ConnectorTableLayout layout, TupleDomain unenforcedConstraint) - { - this.layout = requireNonNull(layout, "layout is null"); - this.unenforcedConstraint = requireNonNull(unenforcedConstraint, "unenforcedConstraint is null"); - } - - public ConnectorTableLayout getTableLayout() - { - return layout; - } - - public TupleDomain getUnenforcedConstraint() - { - return unenforcedConstraint; - } -} diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableProperties.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableProperties.java index 8f51dffe913..1fe6d94c63a 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableProperties.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableProperties.java @@ -36,16 +36,6 @@ public ConnectorTableProperties() this(TupleDomain.all(), Optional.empty(), Optional.empty(), Optional.empty(), emptyList()); } - @Deprecated - public ConnectorTableProperties(ConnectorTableLayout layout) - { - this(layout.getPredicate(), - layout.getTablePartitioning(), - layout.getStreamPartitioningColumns(), - layout.getDiscretePredicates(), - layout.getLocalProperties()); - } - public ConnectorTableProperties( TupleDomain predicate, Optional tablePartitioning, diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index e527a919cc3..d98e83a48d5 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -34,7 +34,6 @@ import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; import io.trino.spi.connector.ConnectorTableLayoutHandle; -import io.trino.spi.connector.ConnectorTableLayoutResult; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTableProperties; import io.trino.spi.connector.ConnectorTableSchema; @@ -97,18 +96,6 @@ public ClassLoaderSafeConnectorMetadata(@ForClassLoaderSafe ConnectorMetadata de this.classLoader = requireNonNull(classLoader, "classLoader is null"); } - @Override - public List getTableLayouts( - ConnectorSession session, - ConnectorTableHandle table, - Constraint constraint, - Optional> desiredColumns) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.getTableLayouts(session, table, constraint, desiredColumns); - } - } - @Override public Optional getCommonPartitioningHandle(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right) { From ac8a8a0fa1b1aa28464f19aec8da35745ebb241c Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 13:20:52 +0530 Subject: [PATCH 08/12] Remove TableDeleteOptimizer optimizer This is already implemented by PushDeleteIntoConnector rule --- .../io/trino/sql/planner/PlanOptimizers.java | 2 - .../optimizations/TableDeleteOptimizer.java | 121 ------------------ 2 files changed, 123 deletions(-) delete mode 100644 core/trino-main/src/main/java/io/trino/sql/planner/optimizations/TableDeleteOptimizer.java diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/PlanOptimizers.java b/core/trino-main/src/main/java/io/trino/sql/planner/PlanOptimizers.java index 33b4401ddff..1d5b239f049 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/PlanOptimizers.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/PlanOptimizers.java @@ -244,7 +244,6 @@ import io.trino.sql.planner.optimizations.PredicatePushDown; import io.trino.sql.planner.optimizations.ReplicateSemiJoinInDelete; import io.trino.sql.planner.optimizations.StatsRecordingPlanOptimizer; -import io.trino.sql.planner.optimizations.TableDeleteOptimizer; import io.trino.sql.planner.optimizations.TransformQuantifiedComparisonApplyToCorrelatedJoin; import io.trino.sql.planner.optimizations.UnaliasSymbolReferences; import io.trino.sql.planner.optimizations.WindowFilterPushDown; @@ -933,7 +932,6 @@ public PlanOptimizers( // Precomputed hashes - this assumes that partitioning will not change builder.add(new HashGenerationOptimizer(metadata)); - builder.add(new TableDeleteOptimizer(metadata)); builder.add(new BeginTableWrite(metadata)); // HACK! see comments in BeginTableWrite // TODO: consider adding a formal final plan sanitization optimizer that prepares the plan for transmission/execution/logging diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/optimizations/TableDeleteOptimizer.java b/core/trino-main/src/main/java/io/trino/sql/planner/optimizations/TableDeleteOptimizer.java deleted file mode 100644 index efdf847a70e..00000000000 --- a/core/trino-main/src/main/java/io/trino/sql/planner/optimizations/TableDeleteOptimizer.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.sql.planner.optimizations; - -import com.google.common.collect.Iterables; -import io.trino.Session; -import io.trino.execution.warnings.WarningCollector; -import io.trino.metadata.Metadata; -import io.trino.sql.planner.PlanNodeIdAllocator; -import io.trino.sql.planner.SymbolAllocator; -import io.trino.sql.planner.TypeProvider; -import io.trino.sql.planner.plan.DeleteNode; -import io.trino.sql.planner.plan.ExchangeNode; -import io.trino.sql.planner.plan.PlanNode; -import io.trino.sql.planner.plan.SimplePlanRewriter; -import io.trino.sql.planner.plan.TableDeleteNode; -import io.trino.sql.planner.plan.TableFinishNode; -import io.trino.sql.planner.plan.TableScanNode; - -import java.util.List; -import java.util.Optional; - -import static java.util.Objects.requireNonNull; - -/** - * Converts delete followed immediately by table scan to a special table-only delete node - *

- * Turn - *

- *     TableCommit - Delete - TableScanNode (no node allowed in between except Exchanges)
- * 
- * into - *
- *     TableDelete
- * 
- */ -public class TableDeleteOptimizer - implements PlanOptimizer -{ - private final Metadata metadata; - - public TableDeleteOptimizer(Metadata metadata) - { - requireNonNull(metadata, "metadata is null"); - - this.metadata = metadata; - } - - @Override - public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) - { - return SimplePlanRewriter.rewriteWith(new Optimizer(session, metadata, idAllocator), plan, null); - } - - private static class Optimizer - extends SimplePlanRewriter - { - private final PlanNodeIdAllocator idAllocator; - private final Session session; - private final Metadata metadata; - - private Optimizer(Session session, Metadata metadata, PlanNodeIdAllocator idAllocator) - { - this.session = session; - this.metadata = metadata; - this.idAllocator = idAllocator; - } - - @Override - public PlanNode visitTableFinish(TableFinishNode node, RewriteContext context) - { - Optional delete = findNode(node.getSource(), DeleteNode.class); - if (delete.isEmpty()) { - return context.defaultRewrite(node); - } - Optional tableScan = findNode(delete.get().getSource(), TableScanNode.class); - if (tableScan.isEmpty()) { - return context.defaultRewrite(node); - } - TableScanNode tableScanNode = tableScan.get(); - if (!metadata.supportsMetadataDelete(session, tableScanNode.getTable())) { - return context.defaultRewrite(node); - } - return new TableDeleteNode( - idAllocator.getNextId(), - tableScanNode.getTable(), - Iterables.getOnlyElement(node.getOutputSymbols())); - } - - private static Optional findNode(PlanNode source, Class clazz) - { - while (true) { - // allow any chain of linear exchanges - if (source instanceof ExchangeNode) { - List sources = source.getSources(); - if (sources.size() != 1) { - return Optional.empty(); - } - source = sources.get(0); - } - else if (clazz.isInstance(source)) { - return Optional.of(clazz.cast(source)); - } - else { - return Optional.empty(); - } - } - } - } -} From d9e2d5deadacadc5b540f40085dce9bf8952905a Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 13:57:08 +0530 Subject: [PATCH 09/12] Remove deprecated metadata delete APIs involving LayoutHandle --- .../main/java/io/trino/metadata/Metadata.java | 5 ----- .../io/trino/metadata/MetadataManager.java | 20 ------------------- .../trino/metadata/AbstractMockMetadata.java | 6 ------ .../spi/connector/ConnectorMetadata.java | 18 ----------------- .../ClassLoaderSafeConnectorMetadata.java | 17 ---------------- .../plugin/jdbc/DefaultJdbcMetadata.java | 7 ------- .../plugin/raptor/legacy/RaptorMetadata.java | 7 ------- 7 files changed, 80 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/Metadata.java b/core/trino-main/src/main/java/io/trino/metadata/Metadata.java index 061ec1aeafb..d9527bab54d 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/Metadata.java +++ b/core/trino-main/src/main/java/io/trino/metadata/Metadata.java @@ -341,11 +341,6 @@ Optional finishRefreshMaterializedView( */ ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tableHandle, List updatedColumns); - /** - * @return whether delete without table scan is supported - */ - boolean supportsMetadataDelete(Session session, TableHandle tableHandle); - /** * Push delete into connector */ diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index f8cbbe729f7..07d5b211bcb 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -1017,22 +1017,6 @@ public ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tabl return metadata.getUpdateRowIdColumnHandle(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), updatedColumns); } - @Override - public boolean supportsMetadataDelete(Session session, TableHandle tableHandle) - { - CatalogName catalogName = tableHandle.getCatalogName(); - ConnectorMetadata metadata = getMetadata(session, catalogName); - - if (!metadata.usesLegacyTableLayouts()) { - return false; - } - - return metadata.supportsMetadataDelete( - session.toConnectorSession(catalogName), - tableHandle.getConnectorHandle(), - tableHandle.getLayout().get()); - } - @Override public Optional applyDelete(Session session, TableHandle table) { @@ -1055,10 +1039,6 @@ public OptionalLong executeDelete(Session session, TableHandle table) ConnectorMetadata metadata = getMetadataForWrite(session, catalogName); ConnectorSession connectorSession = session.toConnectorSession(catalogName); - if (metadata.usesLegacyTableLayouts()) { - checkArgument(table.getLayout().isPresent(), "table layout is missing"); - return metadata.metadataDelete(session.toConnectorSession(catalogName), table.getConnectorHandle(), table.getLayout().get()); - } checkArgument(table.getLayout().isEmpty(), "table layout should not be present"); return metadata.executeDelete(connectorSession, table.getConnectorHandle()); diff --git a/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java b/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java index ba280667f28..2ddade643c3 100644 --- a/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java +++ b/core/trino-main/src/test/java/io/trino/metadata/AbstractMockMetadata.java @@ -428,12 +428,6 @@ public ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tabl throw new UnsupportedOperationException(); } - @Override - public boolean supportsMetadataDelete(Session session, TableHandle tableHandle) - { - throw new UnsupportedOperationException(); - } - @Override public Optional applyDelete(Session session, TableHandle tableHandle) { diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index ddf2c059d10..6bd890dbc98 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -772,24 +772,6 @@ default Optional getSchemaOwner(ConnectorSession session, Catalo return Optional.empty(); } - /** - * @return whether delete without table scan is supported - */ - default boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - throw new TrinoException(NOT_SUPPORTED, "This connector does not support deletes"); - } - - /** - * Delete the provided table layout - * - * @return number of rows deleted, or null for unknown - */ - default OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - throw new TrinoException(NOT_SUPPORTED, "This connector does not support deletes"); - } - /** * Attempt to push down a delete operation into the connector. If a connector * can execute a delete for the table handle on its own, it should return a diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index d98e83a48d5..5e606c1d5ea 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -33,7 +33,6 @@ import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTableProperties; import io.trino.spi.connector.ConnectorTableSchema; @@ -670,22 +669,6 @@ public void finishDelete(ConnectorSession session, ConnectorTableHandle tableHan } } - @Override - public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.supportsMetadataDelete(session, tableHandle, tableLayoutHandle); - } - } - - @Override - public OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.metadataDelete(session, tableHandle, tableLayoutHandle); - } - } - @Override public Optional applyDelete(ConnectorSession session, ConnectorTableHandle handle) { diff --git a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java index ef49e3e596f..f6a9d5ddd8f 100644 --- a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java +++ b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java @@ -30,7 +30,6 @@ import io.trino.spi.connector.ConnectorOutputTableHandle; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTableProperties; import io.trino.spi.connector.ConnectorTableSchema; @@ -697,12 +696,6 @@ public ConnectorTableHandle beginDelete(ConnectorSession session, ConnectorTable throw new TrinoException(NOT_SUPPORTED, "Unsupported delete"); } - @Override - public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - return true; - } - @Override public Optional applyDelete(ConnectorSession session, ConnectorTableHandle handle) { diff --git a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java index 3c5fb7b48d6..1c9ecd0c981 100644 --- a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java +++ b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java @@ -45,7 +45,6 @@ import io.trino.spi.connector.ConnectorPartitioningHandle; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTablePartitioning; import io.trino.spi.connector.ConnectorTableProperties; @@ -838,12 +837,6 @@ public void finishDelete(ConnectorSession session, ConnectorTableHandle tableHan clearRollback(); } - @Override - public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle) - { - return false; - } - @Override public void createView(ConnectorSession session, SchemaTableName viewName, ConnectorViewDefinition definition, boolean replace) { From 3d55b56a66e852aeb03ef3bd884affdf889472f9 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 14:54:23 +0530 Subject: [PATCH 10/12] Remove ConnectorTableLayoutHandle from TableHandle --- .../io/trino/metadata/MetadataManager.java | 36 ++++++++----------- .../java/io/trino/metadata/TableHandle.java | 24 +++---------- .../java/io/trino/testing/TestingHandles.java | 5 +-- .../io/trino/cost/TestCostCalculator.java | 2 +- .../execution/BaseDataDefinitionTaskTest.java | 3 +- .../TestCreateMaterializedViewTask.java | 3 +- .../trino/execution/TestCreateTableTask.java | 3 +- .../TestEffectivePredicateExtractor.java | 3 +- .../TestTableScanNodePartitioning.java | 3 +- .../rule/TestApplyTableScanRedirection.java | 3 +- .../TestPruneCountAggregationOverScalar.java | 5 +-- .../rule/TestPruneIndexSourceColumns.java | 4 +-- .../rule/TestPruneTableScanColumns.java | 9 ++--- .../TestPushDistinctLimitIntoTableScan.java | 3 +- .../rule/TestPushDownDereferencesRules.java | 3 +- .../rule/TestPushJoinIntoTableScan.java | 3 +- .../rule/TestPushPredicateIntoTableScan.java | 9 ++--- .../rule/TestPushProjectionIntoTableScan.java | 3 +- .../rule/TestPushTopNIntoTableScan.java | 3 +- .../rule/TestRemoveEmptyDeleteRuleSet.java | 6 ++-- ...TestRemoveRedundantTableScanPredicate.java | 8 ++--- ...mCorrelatedSingleRowSubqueryToProject.java | 5 +-- .../iterative/rule/test/PlanBuilder.java | 9 ++--- .../iterative/rule/test/TestRuleTester.java | 3 +- .../TestRemoveUnsupportedDynamicFilters.java | 6 ++-- .../TestUnaliasSymbolReferences.java | 3 +- .../sanity/TestDynamicFiltersChecker.java | 6 ++-- ...ValidateAggregationsWithDefaultValues.java | 5 +-- .../TestValidateLimitWithPresortedInput.java | 3 +- .../TestValidateStreamingAggregations.java | 4 +-- .../connector/ConnectorHandleResolver.java | 5 --- .../TestNodeLocalDynamicSplitPruning.java | 3 +- .../TestConnectorPushdownRulesWithHive.java | 11 +++--- .../TestThriftProjectionPushdown.java | 6 ++-- 34 files changed, 64 insertions(+), 146 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index 07d5b211bcb..9c5bccd2309 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -327,16 +327,14 @@ public Optional getTableHandle(Session session, QualifiedObjectName .map(connectorTableHandle -> new TableHandle( catalogName, connectorTableHandle, - catalogMetadata.getTransactionHandleFor(catalogName), - Optional.empty())); + catalogMetadata.getTransactionHandleFor(catalogName))); } return Optional.ofNullable(metadata.getTableHandle(connectorSession, table.asSchemaTableName())) .map(connectorTableHandle -> new TableHandle( catalogName, connectorTableHandle, - catalogMetadata.getTransactionHandleFor(catalogName), - Optional.empty())); + catalogMetadata.getTransactionHandleFor(catalogName))); }); } @@ -356,8 +354,7 @@ public Optional getTableHandleForStatisticsCollection(Session sessi return Optional.of(new TableHandle( catalogName, tableHandle, - catalogMetadata.getTransactionHandleFor(catalogName), - Optional.empty())); + catalogMetadata.getTransactionHandleFor(catalogName))); } } return Optional.empty(); @@ -460,12 +457,11 @@ public TableHandle makeCompatiblePartitioning(Session session, TableHandle table ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogName); ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(catalogName); - verify(tableHandle.getLayout().isEmpty(), "layout should not be present"); ConnectorTableHandle newTableHandle = metadata.makeCompatiblePartitioning( session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), partitioningHandle.getConnectorHandle()); - return new TableHandle(catalogName, newTableHandle, transaction, Optional.empty()); + return new TableHandle(catalogName, newTableHandle, transaction); } @Override @@ -1029,7 +1025,7 @@ public Optional applyDelete(Session session, TableHandle table) ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyDelete(connectorSession, table.getConnectorHandle()) - .map(newHandle -> new TableHandle(catalogName, newHandle, table.getTransaction(), Optional.empty())); + .map(newHandle -> new TableHandle(catalogName, newHandle, table.getTransaction())); } @Override @@ -1039,8 +1035,6 @@ public OptionalLong executeDelete(Session session, TableHandle table) ConnectorMetadata metadata = getMetadataForWrite(session, catalogName); ConnectorSession connectorSession = session.toConnectorSession(catalogName); - checkArgument(table.getLayout().isEmpty(), "table layout should not be present"); - return metadata.executeDelete(connectorSession, table.getConnectorHandle()); } @@ -1050,7 +1044,7 @@ public TableHandle beginDelete(Session session, TableHandle tableHandle) CatalogName catalogName = tableHandle.getCatalogName(); ConnectorMetadata metadata = getMetadataForWrite(session, catalogName); ConnectorTableHandle newHandle = metadata.beginDelete(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), getRetryPolicy(session).getRetryMode()); - return new TableHandle(tableHandle.getCatalogName(), newHandle, tableHandle.getTransaction(), tableHandle.getLayout()); + return new TableHandle(tableHandle.getCatalogName(), newHandle, tableHandle.getTransaction()); } @Override @@ -1067,7 +1061,7 @@ public TableHandle beginUpdate(Session session, TableHandle tableHandle, List> applyLimit(Session session, ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyLimit(connectorSession, table.getConnectorHandle(), limit) .map(result -> new LimitApplicationResult<>( - new TableHandle(catalogName, result.getHandle(), table.getTransaction(), Optional.empty()), + new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.isLimitGuaranteed(), result.isPrecalculateStatistics())); } @@ -1585,8 +1579,7 @@ public Optional> applySample(Session sessio .map(result -> new SampleApplicationResult<>(new TableHandle( catalogName, result.getHandle(), - table.getTransaction(), - Optional.empty()), + table.getTransaction()), result.isPrecalculateStatistics())); } @@ -1614,7 +1607,7 @@ public Optional> applyAggregation( verifyProjection(table, result.getProjections(), result.getAssignments(), aggregations.size()); return new AggregationApplicationResult<>( - new TableHandle(catalogName, result.getHandle(), table.getTransaction(), Optional.empty()), + new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.getProjections(), result.getAssignments(), result.getGroupingColumnMapping(), @@ -1676,8 +1669,7 @@ public Optional> applyJoin( new TableHandle( catalogName, result.getTableHandle(), - transaction, - Optional.empty()), + transaction), result.getLeftColumnHandles(), result.getRightColumnHandles(), result.isPrecalculateStatistics()); @@ -1702,7 +1694,7 @@ public Optional> applyTopN( ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyTopN(connectorSession, table.getConnectorHandle(), topNCount, sortItems, assignments) .map(result -> new TopNApplicationResult<>( - new TableHandle(catalogName, result.getHandle(), table.getTransaction(), Optional.empty()), + new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.isTopNGuaranteed(), result.isPrecalculateStatistics())); } @@ -1751,7 +1743,7 @@ public Optional> applyFilter(Session se ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyFilter(connectorSession, table.getConnectorHandle(), constraint) .map(result -> new ConstraintApplicationResult<>( - new TableHandle(catalogName, result.getHandle(), table.getTransaction(), Optional.empty()), + new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.getRemainingFilter(), result.isPrecalculateStatistics())); } @@ -1772,7 +1764,7 @@ public Optional> applyProjection(Sessio verifyProjection(table, result.getProjections(), result.getAssignments(), projections.size()); return new ProjectionApplicationResult<>( - new TableHandle(catalogName, result.getHandle(), table.getTransaction(), Optional.empty()), + new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.getProjections(), result.getAssignments(), result.isPrecalculateStatistics()); diff --git a/core/trino-main/src/main/java/io/trino/metadata/TableHandle.java b/core/trino-main/src/main/java/io/trino/metadata/TableHandle.java index db7ce559dff..92210189e66 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/TableHandle.java +++ b/core/trino-main/src/main/java/io/trino/metadata/TableHandle.java @@ -17,11 +17,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.trino.connector.CatalogName; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; import java.util.Objects; -import java.util.Optional; import static java.util.Objects.requireNonNull; @@ -31,21 +29,15 @@ public final class TableHandle private final ConnectorTableHandle connectorHandle; private final ConnectorTransactionHandle transaction; - // Table layouts are deprecated, but we keep this here to hide the notion of layouts - // from the engine. TODO: it should be removed once table layouts are finally deleted - private final Optional layout; - @JsonCreator public TableHandle( @JsonProperty("catalogName") CatalogName catalogName, @JsonProperty("connectorHandle") ConnectorTableHandle connectorHandle, - @JsonProperty("transaction") ConnectorTransactionHandle transaction, - @JsonProperty("layout") Optional layout) + @JsonProperty("transaction") ConnectorTransactionHandle transaction) { this.catalogName = requireNonNull(catalogName, "catalogName is null"); this.connectorHandle = requireNonNull(connectorHandle, "connectorHandle is null"); this.transaction = requireNonNull(transaction, "transaction is null"); - this.layout = requireNonNull(layout, "layout is null"); } @JsonProperty @@ -60,12 +52,6 @@ public ConnectorTableHandle getConnectorHandle() return connectorHandle; } - @JsonProperty - public Optional getLayout() - { - return layout; - } - @JsonProperty public ConnectorTransactionHandle getTransaction() { @@ -77,8 +63,7 @@ public TableHandle withConnectorHandle(ConnectorTableHandle connectorHandle) return new TableHandle( catalogName, connectorHandle, - transaction, - layout); + transaction); } @Override @@ -99,13 +84,12 @@ public boolean equals(Object o) TableHandle other = (TableHandle) o; return Objects.equals(catalogName, other.catalogName) && Objects.equals(connectorHandle, other.connectorHandle) && - Objects.equals(transaction, other.transaction) && - Objects.equals(layout, other.layout); + Objects.equals(transaction, other.transaction); } @Override public int hashCode() { - return Objects.hash(catalogName, connectorHandle, transaction, layout); + return Objects.hash(catalogName, connectorHandle, transaction); } } diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingHandles.java b/core/trino-main/src/main/java/io/trino/testing/TestingHandles.java index 5cf6ee8c75e..1d55ee29d3a 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingHandles.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingHandles.java @@ -17,8 +17,6 @@ import io.trino.metadata.TableHandle; import io.trino.testing.TestingMetadata.TestingTableHandle; -import java.util.Optional; - public final class TestingHandles { private TestingHandles() {} @@ -26,6 +24,5 @@ private TestingHandles() {} public static final TableHandle TEST_TABLE_HANDLE = new TableHandle( new CatalogName("test"), new TestingTableHandle(), - TestingTransactionHandle.create(), - Optional.of(TestingHandle.INSTANCE)); + TestingTransactionHandle.create()); } diff --git a/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java b/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java index 93960964b94..00da4d976d0 100644 --- a/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java +++ b/core/trino-main/src/test/java/io/trino/cost/TestCostCalculator.java @@ -793,7 +793,7 @@ private TableScanNode tableScan(String id, String... symbols) TpchTableHandle tableHandle = new TpchTableHandle("sf1", "orders", 1.0); return new TableScanNode( new PlanNodeId(id), - new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE, Optional.empty()), + new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE), symbolsList, assignments.build(), TupleDomain.all(), diff --git a/core/trino-main/src/test/java/io/trino/execution/BaseDataDefinitionTaskTest.java b/core/trino-main/src/test/java/io/trino/execution/BaseDataDefinitionTaskTest.java index 0bd1d28983a..cbf8c6aa207 100644 --- a/core/trino-main/src/test/java/io/trino/execution/BaseDataDefinitionTaskTest.java +++ b/core/trino-main/src/test/java/io/trino/execution/BaseDataDefinitionTaskTest.java @@ -233,8 +233,7 @@ public Optional getTableHandle(Session session, QualifiedObjectName .map(tableMetadata -> new TableHandle( new CatalogName(CATALOG_NAME), new TestingTableHandle(tableName.asSchemaTableName()), - TestingConnectorTransactionHandle.INSTANCE, - Optional.empty())); + TestingConnectorTransactionHandle.INSTANCE)); } @Override diff --git a/core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java b/core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java index d29fa964817..b8518e98c05 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestCreateMaterializedViewTask.java @@ -276,8 +276,7 @@ public Optional getTableHandle(Session session, QualifiedObjectName new TableHandle( new CatalogName(CATALOG_NAME), new TestingTableHandle(tableName.asSchemaTableName()), - TestingConnectorTransactionHandle.INSTANCE, - Optional.empty())); + TestingConnectorTransactionHandle.INSTANCE)); } return Optional.empty(); } diff --git a/core/trino-main/src/test/java/io/trino/execution/TestCreateTableTask.java b/core/trino-main/src/test/java/io/trino/execution/TestCreateTableTask.java index a2e42f8435a..16cd2b6fc79 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestCreateTableTask.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestCreateTableTask.java @@ -333,8 +333,7 @@ public Optional getTableHandle(Session session, QualifiedObjectName new TableHandle( new CatalogName(CATALOG_NAME), new TestingTableHandle(tableName.asSchemaTableName()), - TestingConnectorTransactionHandle.INSTANCE, - Optional.empty())); + TestingConnectorTransactionHandle.INSTANCE)); } return Optional.empty(); } diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/TestEffectivePredicateExtractor.java b/core/trino-main/src/test/java/io/trino/sql/planner/TestEffectivePredicateExtractor.java index 91fdd781b95..7e3758724f0 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/TestEffectivePredicateExtractor.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/TestEffectivePredicateExtractor.java @@ -1246,8 +1246,7 @@ private static TableHandle makeTableHandle(TupleDomain predicate) return new TableHandle( new CatalogName("test"), new PredicatedTableHandle(predicate), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); } /** diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/TestTableScanNodePartitioning.java b/core/trino-main/src/test/java/io/trino/sql/planner/TestTableScanNodePartitioning.java index b9037dee296..4f92fb282bf 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/TestTableScanNodePartitioning.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/TestTableScanNodePartitioning.java @@ -274,7 +274,6 @@ private static TableHandle tableHandle(ConnectorTableHandle connectorTableHandle return new TableHandle( new CatalogName(MOCK_CATALOG), connectorTableHandle, - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); } } diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestApplyTableScanRedirection.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestApplyTableScanRedirection.java index 7778aa03187..8455a00b385 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestApplyTableScanRedirection.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestApplyTableScanRedirection.java @@ -84,8 +84,7 @@ private static TableHandle createTableHandle(ConnectorTableHandle tableHandle) return new TableHandle( new CatalogName(MOCK_CATALOG), tableHandle, - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); } @Test diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java index 69b13ac5d28..a53d5e997f7 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneCountAggregationOverScalar.java @@ -30,8 +30,6 @@ import io.trino.sql.tree.SymbolReference; import org.testng.annotations.Test; -import java.util.Optional; - import static io.trino.plugin.tpch.TpchMetadata.TINY_SCALE_FACTOR; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.DoubleType.DOUBLE; @@ -164,8 +162,7 @@ public void testDoesNotFireOnNestedNonCountAggregate() new TableHandle( new CatalogName("local"), new TpchTableHandle(TINY_SCHEMA_NAME, "orders", TINY_SCALE_FACTOR), - TpchTransactionHandle.INSTANCE, - Optional.empty()), + TpchTransactionHandle.INSTANCE), ImmutableList.of(totalPrice), ImmutableMap.of(totalPrice, new TpchColumnHandle(totalPrice.getName(), DOUBLE)))))); diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneIndexSourceColumns.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneIndexSourceColumns.java index 2cc08f86bf8..0d8428253c8 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneIndexSourceColumns.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestPruneIndexSourceColumns.java @@ -30,7 +30,6 @@ import io.trino.sql.planner.plan.PlanNode; import org.testng.annotations.Test; -import java.util.Optional; import java.util.function.Predicate; import static com.google.common.collect.ImmutableList.toImmutableList; @@ -84,8 +83,7 @@ private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate rule) .on(p -> p.tableDelete( new SchemaTableName("sch", "tab"), p.tableScan( - new TableHandle(CONNECTOR_ID, new TpchTableHandle("sf1", "nation", 1.0), TpchTransactionHandle.INSTANCE, Optional.empty()), + new TableHandle(CONNECTOR_ID, new TpchTableHandle("sf1", "nation", 1.0), TpchTransactionHandle.INSTANCE), ImmutableList.of(), ImmutableMap.of()), p.symbol("a", BigintType.BIGINT))) @@ -52,7 +50,7 @@ public void testDoesNotFire(Rule rule) .on(p -> p.tableWithExchangeDelete( new SchemaTableName("sch", "tab"), p.tableScan( - new TableHandle(CONNECTOR_ID, new TpchTableHandle("sf1", "nation", 1.0), TpchTransactionHandle.INSTANCE, Optional.empty()), + new TableHandle(CONNECTOR_ID, new TpchTableHandle("sf1", "nation", 1.0), TpchTransactionHandle.INSTANCE), ImmutableList.of(), ImmutableMap.of()), p.symbol("a", BigintType.BIGINT))) diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java index 48bd821e400..7da323b2d5b 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestRemoveRedundantTableScanPredicate.java @@ -35,8 +35,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import java.util.Optional; - import static io.trino.spi.predicate.Domain.singleValue; import static io.trino.spi.type.BigintType.BIGINT; import static io.trino.spi.type.VarcharType.createVarcharType; @@ -63,15 +61,13 @@ public void setUpBeforeClass() nationTableHandle = new TableHandle( catalogName, nation, - TpchTransactionHandle.INSTANCE, - Optional.empty()); + TpchTransactionHandle.INSTANCE); TpchTableHandle orders = new TpchTableHandle("sf1", "orders", 1.0); ordersTableHandle = new TableHandle( catalogName, orders, - TpchTransactionHandle.INSTANCE, - Optional.empty()); + TpchTransactionHandle.INSTANCE); } @Test diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestTransformCorrelatedSingleRowSubqueryToProject.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestTransformCorrelatedSingleRowSubqueryToProject.java index 4ae326403dd..720e7bbc473 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestTransformCorrelatedSingleRowSubqueryToProject.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/TestTransformCorrelatedSingleRowSubqueryToProject.java @@ -25,8 +25,6 @@ import io.trino.sql.planner.plan.Assignments; import org.testng.annotations.Test; -import java.util.Optional; - import static io.trino.plugin.tpch.TpchMetadata.TINY_SCALE_FACTOR; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.spi.type.BigintType.BIGINT; @@ -56,8 +54,7 @@ public void testRewrite() new TableHandle( new CatalogName("local"), new TpchTableHandle(TINY_SCHEMA_NAME, "nation", TINY_SCALE_FACTOR), - TpchTransactionHandle.INSTANCE, - Optional.empty()), + TpchTransactionHandle.INSTANCE), ImmutableList.of(p.symbol("l_nationkey")), ImmutableMap.of(p.symbol("l_nationkey"), new TpchColumnHandle("nationkey", BIGINT))), diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/PlanBuilder.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/PlanBuilder.java index 44a5f694efa..12f9e93d737 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/PlanBuilder.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/PlanBuilder.java @@ -99,7 +99,6 @@ import io.trino.sql.tree.FunctionCall; import io.trino.sql.tree.NullLiteral; import io.trino.sql.tree.Row; -import io.trino.testing.TestingHandle; import io.trino.testing.TestingMetadata.TestingColumnHandle; import io.trino.testing.TestingMetadata.TestingTableHandle; import io.trino.testing.TestingTableExecuteHandle; @@ -587,7 +586,7 @@ public TableScanNode tableScan(Consumer consumer) public static class TableScanBuilder { private final PlanNodeIdAllocator idAllocator; - private TableHandle tableHandle = new TableHandle(new CatalogName("testConnector"), new TestingTableHandle(), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)); + private TableHandle tableHandle = new TableHandle(new CatalogName("testConnector"), new TestingTableHandle(), TestingTransactionHandle.create()); private List symbols; private Map assignments; private TupleDomain enforcedConstraint = TupleDomain.all(); @@ -714,8 +713,7 @@ private DeleteTarget deleteTarget(SchemaTableName schemaTableName) Optional.of(new TableHandle( new CatalogName("testConnector"), new TestingTableHandle(), - TestingTransactionHandle.create(), - Optional.of(TestingHandle.INSTANCE))), + TestingTransactionHandle.create())), schemaTableName); } @@ -753,8 +751,7 @@ private UpdateTarget updateTarget(SchemaTableName schemaTableName, List Optional.of(new TableHandle( new CatalogName("testConnector"), new TestingTableHandle(), - TestingTransactionHandle.create(), - Optional.of(TestingHandle.INSTANCE))), + TestingTransactionHandle.create())), schemaTableName, columnsToBeUpdated, columnsToBeUpdated.stream() diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/TestRuleTester.java b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/TestRuleTester.java index 234d8d55e39..dc7a41b881b 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/TestRuleTester.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/iterative/rule/test/TestRuleTester.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; -import java.util.Optional; import static io.trino.sql.planner.assertions.PlanMatchPattern.values; import static io.trino.sql.planner.iterative.rule.test.PlanBuilder.expression; @@ -95,7 +94,7 @@ public void testReportNoFireWithTableScan() (node, captures, context) -> Result.empty())) .on(p -> p.tableScan( - new TableHandle(tester.getCurrentConnectorId(), new TpchTableHandle("sf1", "nation", 1.0), TestingTransactionHandle.create(), Optional.empty()), + new TableHandle(tester.getCurrentConnectorId(), new TpchTableHandle("sf1", "nation", 1.0), TestingTransactionHandle.create()), List.of(p.symbol("x")), Map.of(p.symbol("x"), new TestingColumnHandle("column")))); diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestRemoveUnsupportedDynamicFilters.java b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestRemoveUnsupportedDynamicFilters.java index d27131e5b87..d119c0ef846 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestRemoveUnsupportedDynamicFilters.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestRemoveUnsupportedDynamicFilters.java @@ -87,16 +87,14 @@ public void setup() lineitemTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "lineitem", 1.0), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); lineitemOrderKeySymbol = builder.symbol("LINEITEM_OK", BIGINT); lineitemTableScanNode = builder.tableScan(lineitemTableHandle, ImmutableList.of(lineitemOrderKeySymbol), ImmutableMap.of(lineitemOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT))); TableHandle ordersTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "orders", 1.0), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); ordersOrderKeySymbol = builder.symbol("ORDERS_OK", BIGINT); ordersTableScanNode = builder.tableScan(ordersTableHandle, ImmutableList.of(ordersOrderKeySymbol), ImmutableMap.of(ordersOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT))); } diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestUnaliasSymbolReferences.java b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestUnaliasSymbolReferences.java index 1e7ca1aba87..9b91191f87f 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestUnaliasSymbolReferences.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/optimizations/TestUnaliasSymbolReferences.java @@ -149,8 +149,7 @@ private TableHandle tableHandle(Session session, String tableName) return new TableHandle( new CatalogName(session.getCatalog().get()), new TpchTableHandle(TINY_SCHEMA_NAME, tableName, TINY_SCALE_FACTOR), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); } interface PlanCreator diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestDynamicFiltersChecker.java b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestDynamicFiltersChecker.java index 5c5b5dd4e73..61ceeb4ee63 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestDynamicFiltersChecker.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestDynamicFiltersChecker.java @@ -69,16 +69,14 @@ public void setup() TableHandle lineitemTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "lineitem", 1.0), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); lineitemOrderKeySymbol = builder.symbol("LINEITEM_OK", BIGINT); lineitemTableScanNode = builder.tableScan(lineitemTableHandle, ImmutableList.of(lineitemOrderKeySymbol), ImmutableMap.of(lineitemOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT))); TableHandle ordersTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "orders", 1.0), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); ordersOrderKeySymbol = builder.symbol("ORDERS_OK", BIGINT); ordersTableScanNode = builder.tableScan(ordersTableHandle, ImmutableList.of(ordersOrderKeySymbol), ImmutableMap.of(ordersOrderKeySymbol, new TpchColumnHandle("orderkey", BIGINT))); } diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateAggregationsWithDefaultValues.java b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateAggregationsWithDefaultValues.java index f3e3dced690..b20abb6aa20 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateAggregationsWithDefaultValues.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateAggregationsWithDefaultValues.java @@ -33,8 +33,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import java.util.Optional; - import static io.trino.SessionTestUtils.TEST_SESSION; import static io.trino.spi.type.BigintType.BIGINT; import static io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer; @@ -64,8 +62,7 @@ public void setup() TableHandle nationTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "nation", 1.0), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT); symbol = new Symbol("nationkey"); tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle)); diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateLimitWithPresortedInput.java b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateLimitWithPresortedInput.java index 66c869dfb7b..415a496ea4a 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateLimitWithPresortedInput.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateLimitWithPresortedInput.java @@ -68,8 +68,7 @@ public class TestValidateLimitWithPresortedInput private static final TableHandle MOCK_TABLE_HANDLE = new TableHandle( new CatalogName(MOCK_CATALOG), new MockConnectorTableHandle(MOCK_TABLE_NAME), - TestingTransactionHandle.create(), - Optional.empty()); + TestingTransactionHandle.create()); @Override protected LocalQueryRunner createLocalQueryRunner() diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateStreamingAggregations.java b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateStreamingAggregations.java index 14c4fa46212..4a228242fe3 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateStreamingAggregations.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/sanity/TestValidateStreamingAggregations.java @@ -31,7 +31,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import java.util.Optional; import java.util.function.Function; import static io.trino.spi.type.BigintType.BIGINT; @@ -57,8 +56,7 @@ public void setup() nationTableHandle = new TableHandle( catalogName, new TpchTableHandle("sf1", "nation", 1.0), - TpchTransactionHandle.INSTANCE, - Optional.empty()); + TpchTransactionHandle.INSTANCE); } @Test diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorHandleResolver.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorHandleResolver.java index 347e47a4a3a..2781e297f1c 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorHandleResolver.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorHandleResolver.java @@ -20,11 +20,6 @@ default Class getTableHandleClass() throw new UnsupportedOperationException(); } - default Class getTableLayoutHandleClass() - { - throw new UnsupportedOperationException(); - } - default Class getColumnHandleClass() { throw new UnsupportedOperationException(); diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestNodeLocalDynamicSplitPruning.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestNodeLocalDynamicSplitPruning.java index 3a2b7820e66..3e351df85c9 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestNodeLocalDynamicSplitPruning.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestNodeLocalDynamicSplitPruning.java @@ -153,8 +153,7 @@ private static ConnectorPageSource createTestingPageSource(HiveTransactionHandle 20, 20, ImmutableList.of()))), - transaction, - Optional.empty()); + transaction); HivePageSourceProvider provider = new HivePageSourceProvider( TESTING_TYPE_MANAGER, diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/optimizer/TestConnectorPushdownRulesWithHive.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/optimizer/TestConnectorPushdownRulesWithHive.java index 603534c14ca..1d16bdf8dbf 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/optimizer/TestConnectorPushdownRulesWithHive.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/optimizer/TestConnectorPushdownRulesWithHive.java @@ -161,7 +161,7 @@ public void testProjectionPushdown() Optional.empty()); HiveTableHandle hiveTable = new HiveTableHandle(SCHEMA_NAME, tableName, ImmutableMap.of(), ImmutableList.of(), ImmutableList.of(), Optional.empty()); - TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle(), Optional.empty()); + TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle()); HiveColumnHandle fullColumn = partialColumn.getBaseColumn(); @@ -191,8 +191,7 @@ public void testProjectionPushdown() new TableHandle( new CatalogName(HIVE_CATALOG_NAME), hiveTable.withProjectedColumns(ImmutableSet.of(fullColumn)), - new HiveTransactionHandle(), - Optional.empty()), + new HiveTransactionHandle()), ImmutableList.of(p.symbol("struct_of_int", baseType)), ImmutableMap.of(p.symbol("struct_of_int", baseType), fullColumn)))) .doesNotFire(); @@ -226,7 +225,7 @@ public void testPredicatePushdown() PushPredicateIntoTableScan pushPredicateIntoTableScan = new PushPredicateIntoTableScan(tester().getPlannerContext(), tester().getTypeAnalyzer()); HiveTableHandle hiveTable = new HiveTableHandle(SCHEMA_NAME, tableName, ImmutableMap.of(), ImmutableList.of(), ImmutableList.of(), Optional.empty()); - TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle(), Optional.empty()); + TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle()); HiveColumnHandle column = createBaseColumn("a", 0, HIVE_INT, INTEGER, REGULAR, Optional.empty()); @@ -258,7 +257,7 @@ public void testColumnPruningProjectionPushdown() PruneTableScanColumns pruneTableScanColumns = new PruneTableScanColumns(tester().getMetadata()); HiveTableHandle hiveTable = new HiveTableHandle(SCHEMA_NAME, tableName, ImmutableMap.of(), ImmutableList.of(), ImmutableList.of(), Optional.empty()); - TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle(), Optional.empty()); + TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle()); HiveColumnHandle columnA = createBaseColumn("a", 0, HIVE_INT, INTEGER, REGULAR, Optional.empty()); HiveColumnHandle columnB = createBaseColumn("b", 1, HIVE_INT, INTEGER, REGULAR, Optional.empty()); @@ -301,7 +300,7 @@ public void testPushdownWithDuplicateExpressions() new ScalarStatsCalculator(tester().getPlannerContext(), tester().getTypeAnalyzer())); HiveTableHandle hiveTable = new HiveTableHandle(SCHEMA_NAME, tableName, ImmutableMap.of(), ImmutableList.of(), ImmutableList.of(), Optional.empty()); - TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle(), Optional.empty()); + TableHandle table = new TableHandle(new CatalogName(HIVE_CATALOG_NAME), hiveTable, new HiveTransactionHandle()); HiveColumnHandle bigintColumn = createBaseColumn("just_bigint", 1, toHiveType(BIGINT), BIGINT, REGULAR, Optional.empty()); HiveColumnHandle partialColumn = new HiveColumnHandle( diff --git a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/integration/TestThriftProjectionPushdown.java b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/integration/TestThriftProjectionPushdown.java index d8799b9bd3b..4efa37be2ae 100644 --- a/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/integration/TestThriftProjectionPushdown.java +++ b/plugin/trino-thrift/src/test/java/io/trino/plugin/thrift/integration/TestThriftProjectionPushdown.java @@ -67,8 +67,7 @@ public class TestThriftProjectionPushdown private static final TableHandle NATION_TABLE = new TableHandle( new CatalogName(CATALOG), NATION_THRIFT_TABLE, - ThriftTransactionHandle.INSTANCE, - Optional.empty()); + ThriftTransactionHandle.INSTANCE); private static final Session SESSION = testSessionBuilder() .setCatalog(CATALOG) @@ -153,8 +152,7 @@ public void testDoesNotFire() new TableHandle( new CatalogName(CATALOG), tableWithColumns, - ThriftTransactionHandle.INSTANCE, - Optional.empty()), + ThriftTransactionHandle.INSTANCE), ImmutableList.of(orderStatusSymbol), ImmutableMap.of(orderStatusSymbol, columnHandle))); }) From d9a4ea04f688a7a9e9304fe4926f4c0d5d48619a Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 15:16:10 +0530 Subject: [PATCH 11/12] Remove ConnectorTableLayoutHandle --- .../io/trino/metadata/HandleJsonModule.java | 7 ------- .../io/trino/metadata/HandleResolver.java | 21 +------------------ .../trino/metadata/RemoteHandleResolver.java | 7 ------- .../trino/split/EmptySplitHandleResolver.java | 7 ------- .../java/io/trino/testing/TestingHandle.java | 3 +-- .../trino/testing/TestingHandleResolver.java | 7 ------- .../connector/ConnectorTableLayoutHandle.java | 19 ----------------- 7 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutHandle.java diff --git a/core/trino-main/src/main/java/io/trino/metadata/HandleJsonModule.java b/core/trino-main/src/main/java/io/trino/metadata/HandleJsonModule.java index 8e8c3b405b7..654d550c693 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/HandleJsonModule.java +++ b/core/trino-main/src/main/java/io/trino/metadata/HandleJsonModule.java @@ -25,7 +25,6 @@ import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; public class HandleJsonModule @@ -43,12 +42,6 @@ public static com.fasterxml.jackson.databind.Module tableHandleModule(HandleReso return new AbstractTypedJacksonModule<>(ConnectorTableHandle.class, resolver::getId, resolver::getTableHandleClass) {}; } - @ProvidesIntoSet - public static com.fasterxml.jackson.databind.Module tableLayoutHandleModule(HandleResolver resolver) - { - return new AbstractTypedJacksonModule<>(ConnectorTableLayoutHandle.class, resolver::getId, resolver::getTableLayoutHandleClass) {}; - } - @ProvidesIntoSet public static com.fasterxml.jackson.databind.Module columnHandleModule(HandleResolver resolver) { diff --git a/core/trino-main/src/main/java/io/trino/metadata/HandleResolver.java b/core/trino-main/src/main/java/io/trino/metadata/HandleResolver.java index bd8e834f2a2..9a59e2acee4 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/HandleResolver.java +++ b/core/trino-main/src/main/java/io/trino/metadata/HandleResolver.java @@ -24,7 +24,6 @@ import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableExecuteHandle; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; import io.trino.split.EmptySplitHandleResolver; @@ -74,11 +73,6 @@ public String getId(ConnectorTableHandle tableHandle) return getId(tableHandle, MaterializedHandleResolver::getTableHandleClass); } - public String getId(ConnectorTableLayoutHandle handle) - { - return getId(handle, MaterializedHandleResolver::getTableLayoutHandleClass); - } - public String getId(ColumnHandle columnHandle) { return getId(columnHandle, MaterializedHandleResolver::getColumnHandleClass); @@ -124,11 +118,6 @@ public Class getTableHandleClass(String id) return resolverFor(id).getTableHandleClass().orElseThrow(() -> new IllegalArgumentException("No resolver for " + id)); } - public Class getTableLayoutHandleClass(String id) - { - return resolverFor(id).getTableLayoutHandleClass().orElseThrow(() -> new IllegalArgumentException("No resolver for " + id)); - } - public Class getColumnHandleClass(String id) { return resolverFor(id).getColumnHandleClass().orElseThrow(() -> new IllegalArgumentException("No resolver for " + id)); @@ -193,7 +182,6 @@ private String getId(T handle, Function> tableHandle; - private final Optional> layoutHandle; private final Optional> columnHandle; private final Optional> split; private final Optional> indexHandle; @@ -206,7 +194,6 @@ private static class MaterializedHandleResolver public MaterializedHandleResolver(ConnectorHandleResolver resolver) { tableHandle = getHandleClass(resolver::getTableHandleClass); - layoutHandle = getHandleClass(resolver::getTableLayoutHandleClass); columnHandle = getHandleClass(resolver::getColumnHandleClass); split = getHandleClass(resolver::getSplitClass); indexHandle = getHandleClass(resolver::getIndexHandleClass); @@ -232,11 +219,6 @@ public Optional> getTableHandleClass() return tableHandle; } - public Optional> getTableLayoutHandleClass() - { - return layoutHandle; - } - public Optional> getColumnHandleClass() { return columnHandle; @@ -288,7 +270,6 @@ public boolean equals(Object o) } MaterializedHandleResolver that = (MaterializedHandleResolver) o; return Objects.equals(tableHandle, that.tableHandle) && - Objects.equals(layoutHandle, that.layoutHandle) && Objects.equals(columnHandle, that.columnHandle) && Objects.equals(split, that.split) && Objects.equals(indexHandle, that.indexHandle) && @@ -302,7 +283,7 @@ public boolean equals(Object o) @Override public int hashCode() { - return Objects.hash(tableHandle, layoutHandle, columnHandle, split, indexHandle, outputTableHandle, insertTableHandle, tableExecuteHandle, partitioningHandle, transactionHandle); + return Objects.hash(tableHandle, columnHandle, split, indexHandle, outputTableHandle, insertTableHandle, tableExecuteHandle, partitioningHandle, transactionHandle); } } } diff --git a/core/trino-main/src/main/java/io/trino/metadata/RemoteHandleResolver.java b/core/trino-main/src/main/java/io/trino/metadata/RemoteHandleResolver.java index dc3b00b16fe..8964f2f9669 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/RemoteHandleResolver.java +++ b/core/trino-main/src/main/java/io/trino/metadata/RemoteHandleResolver.java @@ -18,7 +18,6 @@ import io.trino.spi.connector.ConnectorPartitioningHandle; import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; import io.trino.split.RemoteSplit; import io.trino.sql.planner.SystemPartitioningHandle; @@ -32,12 +31,6 @@ public Class getTableHandleClass() throw new UnsupportedOperationException(); } - @Override - public Class getTableLayoutHandleClass() - { - throw new UnsupportedOperationException(); - } - @Override public Class getColumnHandleClass() { diff --git a/core/trino-main/src/main/java/io/trino/split/EmptySplitHandleResolver.java b/core/trino-main/src/main/java/io/trino/split/EmptySplitHandleResolver.java index a515eb7e92c..90400cf6979 100644 --- a/core/trino-main/src/main/java/io/trino/split/EmptySplitHandleResolver.java +++ b/core/trino-main/src/main/java/io/trino/split/EmptySplitHandleResolver.java @@ -17,7 +17,6 @@ import io.trino.spi.connector.ConnectorHandleResolver; import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; public class EmptySplitHandleResolver implements ConnectorHandleResolver @@ -28,12 +27,6 @@ public Class getTableHandleClass() throw new UnsupportedOperationException(); } - @Override - public Class getTableLayoutHandleClass() - { - throw new UnsupportedOperationException(); - } - @Override public Class getColumnHandleClass() { diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingHandle.java b/core/trino-main/src/main/java/io/trino/testing/TestingHandle.java index 353bc2c922c..f9926712686 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingHandle.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingHandle.java @@ -15,10 +15,9 @@ import io.trino.spi.connector.ConnectorInsertTableHandle; import io.trino.spi.connector.ConnectorOutputTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; public enum TestingHandle - implements ConnectorOutputTableHandle, ConnectorInsertTableHandle, ConnectorTableLayoutHandle + implements ConnectorOutputTableHandle, ConnectorInsertTableHandle { INSTANCE } diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingHandleResolver.java b/core/trino-main/src/main/java/io/trino/testing/TestingHandleResolver.java index 24f3b0f1c29..f25ae3fa9ca 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingHandleResolver.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingHandleResolver.java @@ -19,7 +19,6 @@ import io.trino.spi.connector.ConnectorOutputTableHandle; import io.trino.spi.connector.ConnectorSplit; import io.trino.spi.connector.ConnectorTableHandle; -import io.trino.spi.connector.ConnectorTableLayoutHandle; import io.trino.spi.connector.ConnectorTransactionHandle; import io.trino.testing.TestingMetadata.TestingColumnHandle; import io.trino.testing.TestingMetadata.TestingTableHandle; @@ -33,12 +32,6 @@ public Class getTableHandleClass() return TestingTableHandle.class; } - @Override - public Class getTableLayoutHandleClass() - { - return TestingHandle.class; - } - @Override public Class getColumnHandleClass() { diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutHandle.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutHandle.java deleted file mode 100644 index 642ed3b72f4..00000000000 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorTableLayoutHandle.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.spi.connector; - -@Deprecated -public interface ConnectorTableLayoutHandle -{ -} From ccd0695df064e4d02d4b43d8c63c4c4ac968b280 Mon Sep 17 00:00:00 2001 From: praveenkrishna Date: Thu, 6 Jan 2022 15:26:11 +0530 Subject: [PATCH 12/12] Remove ConnectorMetadata#usesLegacyTableLayouts --- .../InformationSchemaMetadata.java | 6 ---- .../system/SystemTablesMetadata.java | 6 ---- .../io/trino/metadata/MetadataManager.java | 28 ------------------- .../io/trino/testing/TestingMetadata.java | 6 ---- .../io/trino/connector/MockConnector.java | 6 ---- .../spi/connector/ConnectorMetadata.java | 8 ------ .../ClassLoaderSafeConnectorMetadata.java | 8 ------ .../plugin/accumulo/AccumuloMetadata.java | 6 ---- .../io/trino/plugin/atop/AtopMetadata.java | 6 ---- .../plugin/jdbc/DefaultJdbcMetadata.java | 6 ---- .../plugin/bigquery/BigQueryMetadata.java | 6 ---- .../plugin/blackhole/BlackHoleMetadata.java | 6 ---- .../plugin/cassandra/CassandraMetadata.java | 6 ---- .../elasticsearch/ElasticsearchMetadata.java | 6 ---- .../trino/plugin/example/ExampleMetadata.java | 6 ---- .../plugin/google/sheets/SheetsMetadata.java | 6 ---- .../io/trino/plugin/hive/HiveMetadata.java | 6 ---- .../trino/plugin/iceberg/IcebergMetadata.java | 6 ---- .../java/io/trino/plugin/jmx/JmxMetadata.java | 6 ---- .../io/trino/plugin/kafka/KafkaMetadata.java | 6 ---- .../trino/plugin/kinesis/KinesisMetadata.java | 6 ---- .../io/trino/plugin/kudu/KuduMetadata.java | 6 ---- .../plugin/localfile/LocalFileMetadata.java | 6 ---- .../trino/plugin/memory/MemoryMetadata.java | 6 ---- .../trino/plugin/mongodb/MongoMetadata.java | 6 ---- .../io/trino/plugin/pinot/PinotMetadata.java | 6 ---- .../plugin/prometheus/PrometheusMetadata.java | 6 ---- .../plugin/raptor/legacy/RaptorMetadata.java | 6 ---- .../io/trino/plugin/redis/RedisMetadata.java | 6 ---- .../trino/plugin/thrift/ThriftMetadata.java | 6 ---- .../io/trino/plugin/tpcds/TpcdsMetadata.java | 6 ---- .../io/trino/plugin/tpch/TpchMetadata.java | 6 ---- 32 files changed, 218 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaMetadata.java b/core/trino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaMetadata.java index 9cc864d6a5f..087b371d3ee 100644 --- a/core/trino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaMetadata.java +++ b/core/trino-main/src/main/java/io/trino/connector/informationschema/InformationSchemaMetadata.java @@ -159,12 +159,6 @@ public Map> listTableColumns(ConnectorSess .collect(toImmutableMap(InformationSchemaTable::getSchemaTableName, table -> table.getTableMetadata().getColumns())); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/core/trino-main/src/main/java/io/trino/connector/system/SystemTablesMetadata.java b/core/trino-main/src/main/java/io/trino/connector/system/SystemTablesMetadata.java index e33167dd337..13c5af41217 100644 --- a/core/trino-main/src/main/java/io/trino/connector/system/SystemTablesMetadata.java +++ b/core/trino-main/src/main/java/io/trino/connector/system/SystemTablesMetadata.java @@ -139,12 +139,6 @@ public Map> listTableColumns(ConnectorSess return builder.build(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java index 9c5bccd2309..0b66a770cf5 100644 --- a/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java +++ b/core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java @@ -1019,10 +1019,6 @@ public Optional applyDelete(Session session, TableHandle table) CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyDelete(connectorSession, table.getConnectorHandle()) .map(newHandle -> new TableHandle(catalogName, newHandle, table.getTransaction())); @@ -1552,10 +1548,6 @@ public Optional> applyLimit(Session session, CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyLimit(connectorSession, table.getConnectorHandle(), limit) .map(result -> new LimitApplicationResult<>( @@ -1570,10 +1562,6 @@ public Optional> applySample(Session sessio CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applySample(connectorSession, table.getConnectorHandle(), sampleType, sampleRatio) .map(result -> new SampleApplicationResult<>(new TableHandle( @@ -1597,10 +1585,6 @@ public Optional> applyAggregation( CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyAggregation(connectorSession, table.getConnectorHandle(), aggregations, assignments, groupingSets) .map(result -> { @@ -1687,10 +1671,6 @@ public Optional> applyTopN( CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyTopN(connectorSession, table.getConnectorHandle(), topNCount, sortItems, assignments) .map(result -> new TopNApplicationResult<>( @@ -1736,10 +1716,6 @@ public Optional> applyFilter(Session se CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyFilter(connectorSession, table.getConnectorHandle(), constraint) .map(result -> new ConstraintApplicationResult<>( @@ -1754,10 +1730,6 @@ public Optional> applyProjection(Sessio CatalogName catalogName = table.getCatalogName(); ConnectorMetadata metadata = getMetadata(session, catalogName); - if (metadata.usesLegacyTableLayouts()) { - return Optional.empty(); - } - ConnectorSession connectorSession = session.toConnectorSession(catalogName); return metadata.applyProjection(connectorSession, table.getConnectorHandle(), projections, assignments) .map(result -> { diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java b/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java index 05476d3a831..885e9a13801 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingMetadata.java @@ -328,12 +328,6 @@ public void grantTablePrivileges(ConnectorSession session, SchemaTableName table @Override public void revokeTablePrivileges(ConnectorSession session, SchemaTableName tableName, Set privileges, TrinoPrincipal grantee, boolean grantOption) {} - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java index 3643d2f4bdb..53c3545ddaa 100644 --- a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java +++ b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java @@ -549,12 +549,6 @@ public ColumnHandle getDeleteRowIdColumnHandle(ConnectorSession session, Connect @Override public void finishDelete(ConnectorSession session, ConnectorTableHandle tableHandle, Collection fragments) {} - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java index 6bd890dbc98..6e42602244e 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMetadata.java @@ -942,14 +942,6 @@ default List listTablePrivileges(ConnectorSession session, SchemaTabl return emptyList(); } - /** - * Whether the connector uses the legacy Table Layout feature. - */ - default boolean usesLegacyTableLayouts() - { - return true; - } - default ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { return new ConnectorTableProperties(); diff --git a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java index 5e606c1d5ea..1dd8558e361 100644 --- a/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/classloader/ClassLoaderSafeConnectorMetadata.java @@ -829,14 +829,6 @@ public List listTablePrivileges(ConnectorSession session, SchemaTable } } - @Override - public boolean usesLegacyTableLayouts() - { - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { - return delegate.usesLegacyTableLayouts(); - } - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloMetadata.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloMetadata.java index 566437ab73f..9974f0cdd94 100644 --- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloMetadata.java +++ b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloMetadata.java @@ -333,12 +333,6 @@ public Map> listTableColumns(ConnectorSess return columns.build(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public Optional> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint) { diff --git a/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopMetadata.java b/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopMetadata.java index 6d8e2590561..f118c26065e 100644 --- a/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopMetadata.java +++ b/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopMetadata.java @@ -149,12 +149,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable throw new ColumnNotFoundException(tableName, columnName); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java index f6a9d5ddd8f..e0b3cc4b336 100644 --- a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java +++ b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java @@ -526,12 +526,6 @@ public Optional applyTableScanRedirect(Conne return jdbcClient.getTableScanRedirection(session, tableHandle); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryMetadata.java b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryMetadata.java index 1fe87549364..6bf6395f46e 100644 --- a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryMetadata.java +++ b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryMetadata.java @@ -325,12 +325,6 @@ public Map> listTableColumns(ConnectorSess return columns.build(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java index 49e44809415..4e9abbf1156 100644 --- a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java +++ b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java @@ -349,12 +349,6 @@ public Optional getView(ConnectorSession session, Schem return Optional.ofNullable(views.get(viewName)); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java b/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java index 4db1d228174..b03297123f1 100644 --- a/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java +++ b/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java @@ -198,12 +198,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable return ((CassandraColumnHandle) columnHandle).getColumnMetadata(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public Optional> applyFilter(ConnectorSession session, ConnectorTableHandle tableHandle, Constraint constraint) { diff --git a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchMetadata.java b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchMetadata.java index cd2160b46c0..edea3978ac0 100644 --- a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchMetadata.java +++ b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchMetadata.java @@ -456,12 +456,6 @@ public Map> listTableColumns(ConnectorSess .collect(toImmutableMap(ConnectorTableMetadata::getTable, ConnectorTableMetadata::getColumns)); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleMetadata.java b/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleMetadata.java index a961870f920..9a0d8db635f 100644 --- a/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleMetadata.java +++ b/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleMetadata.java @@ -156,12 +156,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable return ((ExampleColumnHandle) columnHandle).getColumnMetadata(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsMetadata.java b/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsMetadata.java index da4960646ec..32861b35e77 100644 --- a/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsMetadata.java +++ b/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsMetadata.java @@ -151,12 +151,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable return ((SheetsColumnHandle) columnHandle).getColumnMetadata(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java index ad560f86cee..0c6ae62e235 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java @@ -2512,12 +2512,6 @@ public OptionalLong executeDelete(ConnectorSession session, ConnectorTableHandle return OptionalLong.empty(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { 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 fb4cae303f2..7a10b2cb774 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 @@ -688,12 +688,6 @@ public OptionalLong executeDelete(ConnectorSession session, ConnectorTableHandle return OptionalLong.empty(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - public void rollback() { // TODO: cleanup open transaction diff --git a/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxMetadata.java b/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxMetadata.java index 967208f0760..201773eb553 100644 --- a/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxMetadata.java +++ b/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxMetadata.java @@ -102,12 +102,6 @@ public JmxTableHandle getTableHandle(ConnectorSession session, SchemaTableName t return getTableHandle(tableName); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaMetadata.java b/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaMetadata.java index cc4028e8a59..9362deb4103 100644 --- a/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaMetadata.java +++ b/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaMetadata.java @@ -225,12 +225,6 @@ private ConnectorTableMetadata getTableMetadata(ConnectorSession session, Schema return new ConnectorTableMetadata(schemaTableName, builder.build()); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisMetadata.java b/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisMetadata.java index d31fac93bb6..4a03c8286bf 100644 --- a/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisMetadata.java +++ b/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisMetadata.java @@ -86,12 +86,6 @@ public ConnectorTableMetadata getTableMetadata(ConnectorSession connectorSession return getTableMetadata(((KinesisTableHandle) tableHandle).toSchemaTableName()); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduMetadata.java b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduMetadata.java index 78982b95d4d..282455e21b6 100755 --- a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduMetadata.java +++ b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduMetadata.java @@ -397,12 +397,6 @@ public void finishDelete(ConnectorSession session, ConnectorTableHandle tableHan { } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileMetadata.java b/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileMetadata.java index d44bdaf1c95..6f4ff95056e 100644 --- a/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileMetadata.java +++ b/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileMetadata.java @@ -133,12 +133,6 @@ private List listTables(ConnectorSession session, SchemaTablePr return ImmutableList.of(prefix.toSchemaTableName()); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle tableHandle) { diff --git a/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryMetadata.java b/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryMetadata.java index 949cafb4652..96addafb7ba 100644 --- a/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryMetadata.java +++ b/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryMetadata.java @@ -366,12 +366,6 @@ private void updateRowsOnHosts(long tableId, Collection fragments) tables.put(tableId, new TableInfo(tableId, info.getSchemaName(), info.getTableName(), info.getColumns(), dataFragments)); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoMetadata.java b/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoMetadata.java index 85fc3282c63..45636d30ab2 100644 --- a/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoMetadata.java +++ b/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoMetadata.java @@ -221,12 +221,6 @@ public Optional finishInsert(ConnectorSession session, return Optional.empty(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotMetadata.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotMetadata.java index 0471dc91b41..b18fbbabb4e 100755 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotMetadata.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotMetadata.java @@ -480,12 +480,6 @@ private static PinotColumnHandle resolveAggregateExpressionWithAlias(PinotColumn return aggregateColumn; } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @VisibleForTesting public List getPinotColumns(String tableName) { diff --git a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusMetadata.java b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusMetadata.java index df902acc0ba..97151f11f55 100644 --- a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusMetadata.java +++ b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusMetadata.java @@ -155,12 +155,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable return ((PrometheusColumnHandle) columnHandle).getColumnMetadata(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java index 1c9ecd0c981..6fc2a02d987 100644 --- a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java +++ b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorMetadata.java @@ -297,12 +297,6 @@ public Map> listTableColumns(ConnectorSess return Multimaps.asMap(columns.build()); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public Optional> applyFilter(ConnectorSession session, ConnectorTableHandle handle, Constraint constraint) { diff --git a/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisMetadata.java b/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisMetadata.java index 9ab44acafca..2d9537209d8 100644 --- a/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisMetadata.java +++ b/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisMetadata.java @@ -209,12 +209,6 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable return convertColumnHandle(columnHandle).getColumnMetadata(); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle tableHandle) { diff --git a/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftMetadata.java b/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftMetadata.java index 42b0b87d854..663597f0388 100644 --- a/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftMetadata.java +++ b/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftMetadata.java @@ -215,12 +215,6 @@ public Optional> applyProjecti return Optional.of(new ProjectionApplicationResult<>(handle, projections, assignmentList.build(), false)); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - private ThriftTableMetadata getRequiredTableMetadata(SchemaTableName schemaTableName) { Optional table = tableCache.getUnchecked(schemaTableName); diff --git a/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsMetadata.java b/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsMetadata.java index 7d550dd7bba..d3c4be1b6b8 100644 --- a/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsMetadata.java +++ b/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsMetadata.java @@ -99,12 +99,6 @@ public ConnectorTableHandle getTableHandle(ConnectorSession session, SchemaTable return new TpcdsTableHandle(tableName.getTableName(), scaleFactor); } - @Override - public boolean usesLegacyTableLayouts() - { - return false; - } - @Override public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) { diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java index c363b1dedea..635962d0089 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchMetadata.java @@ -426,12 +426,6 @@ public List listTables(ConnectorSession session, Optional