From f0d416dd8eb5ebc0a605f0a19dc8ebd192258f97 Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Sat, 31 Aug 2024 21:46:25 +0900 Subject: [PATCH] Remove deprecated ConnectorMetadata.beginCreateTable without replace --- .../tracing/TracingConnectorMetadata.java | 9 -------- .../spi/connector/ConnectorMetadata.java | 23 +++---------------- .../ClassLoaderSafeConnectorMetadata.java | 8 ------- 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/tracing/TracingConnectorMetadata.java b/core/trino-main/src/main/java/io/trino/tracing/TracingConnectorMetadata.java index 1164109300a0..81df2d43fb4e 100644 --- a/core/trino-main/src/main/java/io/trino/tracing/TracingConnectorMetadata.java +++ b/core/trino-main/src/main/java/io/trino/tracing/TracingConnectorMetadata.java @@ -612,15 +612,6 @@ public void finishStatisticsCollection(ConnectorSession session, ConnectorTableH } } - @Override - public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode) - { - Span span = startSpan("beginCreateTable", tableMetadata.getTable()); - try (var _ = scopedSpan(span)) { - return delegate.beginCreateTable(session, tableMetadata, layout, retryMode); - } - } - @Override public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode, boolean replace) { 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 43bc7096d383..eacc3d734f3b 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 @@ -728,23 +728,6 @@ default void finishStatisticsCollection(ConnectorSession session, ConnectorTable throw new TrinoException(GENERIC_INTERNAL_ERROR, "ConnectorMetadata beginStatisticsCollection() is implemented without finishStatisticsCollection()"); } - /** - * Begin the atomic creation of a table with data. - *

- * If connector does not support execution with retries, the method should throw: - *

-     *     new TrinoException(NOT_SUPPORTED, "This connector does not support query retries")
-     * 
- * unless {@code retryMode} is set to {@code NO_RETRIES}. - * - * @deprecated use {@link #beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode, boolean replace)} - */ - @Deprecated - default ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode) - { - throw new TrinoException(NOT_SUPPORTED, "This connector does not support creating tables with data"); - } - /** * Begin the atomic creation of a table with data. * If connector does not support execution with retries, the method should throw: @@ -756,10 +739,10 @@ default ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Co default ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode, boolean replace) { // Redirect to deprecated SPI to not break existing connectors - if (!replace) { - return beginCreateTable(session, tableMetadata, layout, retryMode); + if (replace) { + throw new TrinoException(NOT_SUPPORTED, "This connector does not support replacing tables"); } - throw new TrinoException(NOT_SUPPORTED, "This connector does not support replacing tables"); + throw new TrinoException(NOT_SUPPORTED, "This connector does not support creating tables with data"); } /** 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 a24552a52e1b..8cb664f1dd61 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 @@ -547,14 +547,6 @@ public void setColumnComment(ConnectorSession session, ConnectorTableHandle tabl } } - @Override - public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode) - { - try (ThreadContextClassLoader _ = new ThreadContextClassLoader(classLoader)) { - return delegate.beginCreateTable(session, tableMetadata, layout, retryMode); - } - } - @Override public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional layout, RetryMode retryMode, boolean replace) {