Search in sources :

Example 1 with AlterRoutineCharacteristics

use of com.facebook.presto.sql.tree.AlterRoutineCharacteristics in project presto by prestodb.

the class TestSqlParser method testAlterFunction.

@Test
public void testAlterFunction() {
    QualifiedName functionName = QualifiedName.of("testing", "default", "tan");
    assertStatement("ALTER FUNCTION testing.default.tan\n" + "CALLED ON NULL INPUT", new AlterFunction(functionName, Optional.empty(), new AlterRoutineCharacteristics(Optional.of(CALLED_ON_NULL_INPUT))));
    assertStatement("ALTER FUNCTION testing.default.tan(double)\n" + "RETURNS NULL ON NULL INPUT", new AlterFunction(functionName, Optional.of(ImmutableList.of("double")), new AlterRoutineCharacteristics(Optional.of(RETURNS_NULL_ON_NULL_INPUT))));
    assertInvalidStatement("ALTER FUNCTION testing.default.tan", "No alter routine characteristics specified");
    assertInvalidStatement("ALTER FUNCTION testing.default.tan\n" + "RETURNS NULL ON NULL INPUT\n" + "RETURNS NULL ON NULL INPUT", "Duplicate null-call clause: RETURNSNULLONNULLINPUT");
}
Also used : AlterRoutineCharacteristics(com.facebook.presto.sql.tree.AlterRoutineCharacteristics) QualifiedName(com.facebook.presto.sql.tree.QualifiedName) AlterFunction(com.facebook.presto.sql.tree.AlterFunction) Test(org.testng.annotations.Test)

Aggregations

AlterFunction (com.facebook.presto.sql.tree.AlterFunction)1 AlterRoutineCharacteristics (com.facebook.presto.sql.tree.AlterRoutineCharacteristics)1 QualifiedName (com.facebook.presto.sql.tree.QualifiedName)1 Test (org.testng.annotations.Test)1