Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ public Optional<String> getSchema()
return session.getSchema();
}

@Override
public Optional<ConnectorId> getConnectorId()
{
return Optional.ofNullable(connectorId);
}

@Override
public boolean isReadConstraints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.facebook.presto.SystemSessionProperties;
import com.facebook.presto.spi.ConnectorId;
import com.facebook.presto.spi.ConnectorPlanOptimizer;
import com.facebook.presto.spi.ConnectorSession;
import com.facebook.presto.spi.VariableAllocator;
import com.facebook.presto.spi.WarningCollector;
import com.facebook.presto.spi.plan.AggregationNode;
Expand Down Expand Up @@ -183,7 +184,9 @@ public PlanOptimizerResult optimize(PlanNode plan, Session session, TypeProvider
// the returned node is still a max closure (only if there is no new connector added, which does happen but ignored here)
for (ConnectorPlanOptimizer optimizer : entry.getValue()) {
long start = System.nanoTime();
newNode = optimizer.optimize(newNode, session.toConnectorSession(connectorId), variableAllocator, idAllocator);
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
checkState(connectorSession.getConnectorId().isPresent());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that connector ID is available in connector optimizer

newNode = optimizer.optimize(newNode, connectorSession, variableAllocator, idAllocator);
if (enableVerboseRuntimeStats || trackOptimizerRuntime(session, optimizer)) {
session.getRuntimeStats().addMetricValue(String.format("optimizer%sTimeNanos", getOptimizerNameForLog(optimizer)), NANO, System.nanoTime() - start);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@ default boolean isReadConstraints()
* @return
*/
ConnectorSession forConnectorId(ConnectorId connectorId);

default Optional<ConnectorId> getConnectorId()
{
return Optional.empty();
}
}
Loading