Search in sources :

Example 1 with ExecutionWriterTarget

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);
    }
}
Also used : ConnectorCapabilities(com.facebook.presto.spi.connector.ConnectorCapabilities) PrestoException(com.facebook.presto.spi.PrestoException) ConnectorId(com.facebook.presto.spi.ConnectorId) ExecutionWriterTarget(com.facebook.presto.execution.scheduler.ExecutionWriterTarget)

Aggregations

ExecutionWriterTarget (com.facebook.presto.execution.scheduler.ExecutionWriterTarget)1 ConnectorId (com.facebook.presto.spi.ConnectorId)1 PrestoException (com.facebook.presto.spi.PrestoException)1 ConnectorCapabilities (com.facebook.presto.spi.connector.ConnectorCapabilities)1