Search in sources :

Example 1 with TableExecute

use of io.trino.sql.tree.TableExecute in project trino by trinodb.

the class TestSqlParser method testTableExecute.

@Test
public void testTableExecute() {
    Table table = new Table(QualifiedName.of("foo"));
    Identifier procedure = new Identifier("bar");
    assertStatement("ALTER TABLE foo EXECUTE bar", new TableExecute(table, procedure, ImmutableList.of(), Optional.empty()));
    assertStatement("ALTER TABLE foo EXECUTE bar(bah => 1, wuh => 'clap') WHERE age > 17", new TableExecute(table, procedure, ImmutableList.of(new CallArgument(identifier("bah"), new LongLiteral("1")), new CallArgument(identifier("wuh"), new StringLiteral("clap"))), Optional.of(new ComparisonExpression(ComparisonExpression.Operator.GREATER_THAN, new Identifier("age"), new LongLiteral("17")))));
    assertStatement("ALTER TABLE foo EXECUTE bar(1, 'clap') WHERE age > 17", new TableExecute(table, procedure, ImmutableList.of(new CallArgument(new LongLiteral("1")), new CallArgument(new StringLiteral("clap"))), Optional.of(new ComparisonExpression(ComparisonExpression.Operator.GREATER_THAN, new Identifier("age"), new LongLiteral("17")))));
}
Also used : TableExecute(io.trino.sql.tree.TableExecute) CallArgument(io.trino.sql.tree.CallArgument) QuantifiedComparisonExpression(io.trino.sql.tree.QuantifiedComparisonExpression) ComparisonExpression(io.trino.sql.tree.ComparisonExpression) CreateTable(io.trino.sql.tree.CreateTable) DropTable(io.trino.sql.tree.DropTable) Table(io.trino.sql.tree.Table) TruncateTable(io.trino.sql.tree.TruncateTable) RenameTable(io.trino.sql.tree.RenameTable) QueryUtil.quotedIdentifier(io.trino.sql.QueryUtil.quotedIdentifier) Identifier(io.trino.sql.tree.Identifier) StringLiteral(io.trino.sql.tree.StringLiteral) LongLiteral(io.trino.sql.tree.LongLiteral) Test(org.junit.jupiter.api.Test)

Aggregations

QueryUtil.quotedIdentifier (io.trino.sql.QueryUtil.quotedIdentifier)1 CallArgument (io.trino.sql.tree.CallArgument)1 ComparisonExpression (io.trino.sql.tree.ComparisonExpression)1 CreateTable (io.trino.sql.tree.CreateTable)1 DropTable (io.trino.sql.tree.DropTable)1 Identifier (io.trino.sql.tree.Identifier)1 LongLiteral (io.trino.sql.tree.LongLiteral)1 QuantifiedComparisonExpression (io.trino.sql.tree.QuantifiedComparisonExpression)1 RenameTable (io.trino.sql.tree.RenameTable)1 StringLiteral (io.trino.sql.tree.StringLiteral)1 Table (io.trino.sql.tree.Table)1 TableExecute (io.trino.sql.tree.TableExecute)1 TruncateTable (io.trino.sql.tree.TruncateTable)1 Test (org.junit.jupiter.api.Test)1