Skip to content

Commit

Permalink
Remove SchemaFuncitonName and use ConnectorTableFunctionHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsaka committed Feb 24, 2025
1 parent 8b7c52c commit 85958b3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -898,17 +898,15 @@ public String toString()
public TableFunctionProcessorProvider getTableFunctionProcessorProvider(TableFunctionHandle tableFunctionHandle)
{
CatalogHandle catalogHandle = tableFunctionHandle.getCatalogHandle();
SchemaFunctionName functionName = tableFunctionHandle.getSchemaFunctionName();

FunctionProvider provider;
if (catalogHandle.equals(GlobalSystemConnector.CATALOG_HANDLE)) {
provider = globalFunctionCatalog;
}
else {
provider = functionProviders.getService(catalogHandle);
checkArgument(provider != null, "No function provider for catalog: '%s' (function '%s')", catalogHandle, functionName);
checkArgument(provider != null, "No function provider for catalog: '%s'", catalogHandle);
}

return provider.getTableFunctionProcessorProvider(functionName);
return provider.getTableFunctionProcessorProvider(tableFunctionHandle.getFunctionHandle());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public Supplier<Optional<UpdatablePageSource>> addSplit(ScheduledSplit split) {

// Todo: This is different to Trino. Do we want to return something here?
// Probably nothing as its mainly used alter the sources of the connector.
// EX, Hive/Iceberg tables.
// EX, Hive/Iceberg tables have an updatable page source. So for
// Table scan operator we have this to addSplit.
/*
if (source instanceof UpdatablePageSource) {
return Optional.of((UpdatablePageSource) source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public SplitSource getSplits(Session session, TableFunctionHandle function)
ConnectorSplitSource source = splitManager.getSplits(
function.getTransactionHandle(),
session.toConnectorSession(catalogHandle),
function.getSchemaFunctionName(),
function.getFunctionHandle());

return new ConnectorAwareSplitSource(catalogHandle, source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import com.facebook.presto.spi.api.Experimental;
import com.facebook.presto.spi.function.table.ConnectorTableFunctionHandle;

// TODO: TableFunctionName
import io.trino.spi.function.SchemaFunctionName;

import static java.util.Objects.requireNonNull;

public interface ConnectorSplitManager
Expand All @@ -37,7 +34,6 @@ ConnectorSplitSource getSplits(
default ConnectorSplitSource getSplits(
ConnectorTransactionHandle transaction,
ConnectorSession session,
SchemaFunctionName name,
ConnectorTableFunctionHandle function) {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.facebook.presto.spi.classloader.ThreadContextClassLoader;
import com.facebook.presto.spi.connector.ConnectorSplitManager;
import com.facebook.presto.spi.connector.ConnectorTransactionHandle;
import io.trino.spi.function.SchemaFunctionName;
import com.facebook.presto.spi.function.table.ConnectorTableFunctionHandle;

import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -48,11 +47,10 @@ public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHand
public ConnectorSplitSource getSplits(
ConnectorTransactionHandle transaction,
ConnectorSession session,
SchemaFunctionName name,
ConnectorTableFunctionHandle function)
{
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
return delegate.getSplits(transaction, session, name, function);
return delegate.getSplits(transaction, session, function);
}
}
}

0 comments on commit 85958b3

Please sign in to comment.