Skip to content

Commit

Permalink
Remove deprecated metadata delete APIs involving LayoutHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
Praveen2112 committed Jan 13, 2022
1 parent da08d15 commit 31476e3
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 80 deletions.
5 changes: 0 additions & 5 deletions core/trino-main/src/main/java/io/trino/metadata/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,6 @@ Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(
*/
ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tableHandle, List<ColumnHandle> updatedColumns);

/**
* @return whether delete without table scan is supported
*/
boolean supportsMetadataDelete(Session session, TableHandle tableHandle);

/**
* Push delete into connector
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TableHandle> applyDelete(Session session, TableHandle table)
{
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TableHandle> applyDelete(Session session, TableHandle tableHandle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,24 +772,6 @@ default Optional<TrinoPrincipal> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ConnectorTableHandle> applyDelete(ConnectorSession session, ConnectorTableHandle handle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ConnectorTableHandle> applyDelete(ConnectorSession session, ConnectorTableHandle handle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 31476e3

Please sign in to comment.