Search in sources :

Example 1 with Deallocate

use of io.prestosql.sql.tree.Deallocate in project hetu-core by openlookeng.

the class PrepareTask method execute.

@Override
public ListenableFuture<?> execute(Prepare prepare, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters, HeuristicIndexerManager heuristicIndexerManager) {
    Statement statement = prepare.getStatement();
    if ((statement instanceof Prepare) || (statement instanceof Execute) || (statement instanceof Deallocate)) {
        String type = statement.getClass().getSimpleName().toUpperCase(ENGLISH);
        throw new PrestoException(NOT_SUPPORTED, "Invalid statement type for prepared statement: " + type);
    }
    String sql = getFormattedSql(statement, sqlParser, Optional.empty());
    stateMachine.addPreparedStatement(prepare.getName().getValue(), sql);
    return immediateFuture(null);
}
Also used : Execute(io.prestosql.sql.tree.Execute) Deallocate(io.prestosql.sql.tree.Deallocate) Statement(io.prestosql.sql.tree.Statement) Prepare(io.prestosql.sql.tree.Prepare) PrestoException(io.prestosql.spi.PrestoException)

Example 2 with Deallocate

use of io.prestosql.sql.tree.Deallocate in project hetu-core by openlookeng.

the class TestDeallocateTask method executeDeallocate.

private Set<String> executeDeallocate(String statementName, String sqlString, Session session) {
    TransactionManager transactionManager = createTestTransactionManager();
    AccessControl accessControl = new AccessControlManager(transactionManager);
    QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
    Deallocate deallocate = new Deallocate(new Identifier(statementName));
    new DeallocateTask().execute(deallocate, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
    return stateMachine.getDeallocatedPreparedStatements();
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) AccessControl(io.prestosql.security.AccessControl) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Identifier(io.prestosql.sql.tree.Identifier) Deallocate(io.prestosql.sql.tree.Deallocate) TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)

Aggregations

Deallocate (io.prestosql.sql.tree.Deallocate)2 NoOpResourceGroupManager (io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)1 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)1 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)1 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)1 AccessControl (io.prestosql.security.AccessControl)1 AccessControlManager (io.prestosql.security.AccessControlManager)1 AllowAllAccessControl (io.prestosql.security.AllowAllAccessControl)1 PrestoException (io.prestosql.spi.PrestoException)1 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)1 Execute (io.prestosql.sql.tree.Execute)1 Identifier (io.prestosql.sql.tree.Identifier)1 Prepare (io.prestosql.sql.tree.Prepare)1 Statement (io.prestosql.sql.tree.Statement)1 InMemoryTransactionManager.createTestTransactionManager (io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager)1 TransactionManager (io.prestosql.transaction.TransactionManager)1