use of com.facebook.presto.execution.scheduler.ExecutionWriterTarget in project presto by prestodb.
the class PrestoSparkQueryExecutionFactory method checkPageSinkCommitIsSupported.
private void checkPageSinkCommitIsSupported(Session session, ExecutionWriterTarget writerTarget) {
ConnectorId connectorId;
if (writerTarget instanceof ExecutionWriterTarget.DeleteHandle) {
throw new PrestoException(NOT_SUPPORTED, "delete queries are not supported by presto on spark");
} else if (writerTarget instanceof ExecutionWriterTarget.CreateHandle) {
connectorId = ((ExecutionWriterTarget.CreateHandle) writerTarget).getHandle().getConnectorId();
} else if (writerTarget instanceof ExecutionWriterTarget.InsertHandle) {
connectorId = ((ExecutionWriterTarget.InsertHandle) writerTarget).getHandle().getConnectorId();
} else if (writerTarget instanceof ExecutionWriterTarget.RefreshMaterializedViewHandle) {
connectorId = ((ExecutionWriterTarget.RefreshMaterializedViewHandle) writerTarget).getHandle().getConnectorId();
} else {
throw new IllegalArgumentException("unexpected writer target type: " + writerTarget.getClass());
}
verify(connectorId != null, "connectorId is null");
Set<ConnectorCapabilities> connectorCapabilities = metadata.getConnectorCapabilities(session, connectorId);
if (!connectorCapabilities.contains(SUPPORTS_PAGE_SINK_COMMIT)) {
throw new PrestoException(NOT_SUPPORTED, "catalog does not support page sink commit: " + connectorId);
}
}
Aggregations