Skip to content

Commit

Permalink
Remove deprecated ConnectorMetadata.beginCreateTable without replace
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Sep 2, 2024
1 parent 25a599e commit f0d416d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,6 @@ public void finishStatisticsCollection(ConnectorSession session, ConnectorTableH
}
}

@Override
public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> 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<ConnectorTableLayout> layout, RetryMode retryMode, boolean replace)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* If connector does not support execution with retries, the method should throw:
* <pre>
* new TrinoException(NOT_SUPPORTED, "This connector does not support query retries")
* </pre>
* 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<ConnectorTableLayout> 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:
Expand All @@ -756,10 +739,10 @@ default ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Co
default ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> 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");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,6 @@ public void setColumnComment(ConnectorSession session, ConnectorTableHandle tabl
}
}

@Override
public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> layout, RetryMode retryMode)
{
try (ThreadContextClassLoader _ = new ThreadContextClassLoader(classLoader)) {
return delegate.beginCreateTable(session, tableMetadata, layout, retryMode);
}
}

@Override
public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> layout, RetryMode retryMode, boolean replace)
{
Expand Down

0 comments on commit f0d416d

Please sign in to comment.