use of com.facebook.presto.sql.tree.DropFunction in project presto by prestodb.
the class TestDropFunctionTask method executeAndGetRemovedSessionFunctions.
private Set<SqlFunctionId> executeAndGetRemovedSessionFunctions(String sqlString, Session session) {
SqlParser parser = new SqlParser();
DropFunction statement = (DropFunction) parser.createStatement(sqlString, ParsingOptions.builder().build());
TransactionManager tm = createTestTransactionManager();
QueryStateMachine stateMachine = createQueryStateMachine(sqlString, session, false, tm, executorService, metadataManager);
WarningCollector warningCollector = stateMachine.getWarningCollector();
DropFunctionTask dropFunctionTask = new DropFunctionTask(parser);
dropFunctionTask.execute(statement, tm, metadataManager, new AllowAllAccessControl(), session, emptyList(), warningCollector);
return dropFunctionTask.getRemovedSessionFunctions();
}
use of com.facebook.presto.sql.tree.DropFunction in project presto by prestodb.
the class TestSqlParser method testDropFunction.
@Test
public void testDropFunction() {
assertStatement("DROP FUNCTION a", new DropFunction(QualifiedName.of("a"), Optional.empty(), false, false));
assertStatement("DROP FUNCTION a.b", new DropFunction(QualifiedName.of("a", "b"), Optional.empty(), false, false));
assertStatement("DROP FUNCTION a.b.c", new DropFunction(QualifiedName.of("a", "b", "c"), Optional.empty(), false, false));
assertStatement("DROP FUNCTION a()", new DropFunction(QualifiedName.of("a"), Optional.of(ImmutableList.of()), false, false));
assertStatement("DROP FUNCTION a.b()", new DropFunction(QualifiedName.of("a", "b"), Optional.of(ImmutableList.of()), false, false));
assertStatement("DROP FUNCTION a.b.c()", new DropFunction(QualifiedName.of("a", "b", "c"), Optional.of(ImmutableList.of()), false, false));
assertStatement("DROP FUNCTION IF EXISTS a.b.c(int)", new DropFunction(QualifiedName.of("a", "b", "c"), Optional.of(ImmutableList.of("int")), false, true));
assertStatement("DROP FUNCTION IF EXISTS a.b.c(bigint, double)", new DropFunction(QualifiedName.of("a", "b", "c"), Optional.of(ImmutableList.of("bigint", "double")), false, true));
assertStatement("DROP FUNCTION IF EXISTS a.b.c(ARRAY(string), MAP(int,double))", new DropFunction(QualifiedName.of("a", "b", "c"), Optional.of(ImmutableList.of("ARRAY(string)", "MAP(int,double)")), false, true));
}
Aggregations