Search in sources :

Example 1 with Analyze

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

the class TestSqlParser method testAnalyze.

@Test
public void testAnalyze() {
    QualifiedName table = QualifiedName.of("foo");
    assertStatement("ANALYZE foo", new Analyze(table, ImmutableList.of()));
    assertStatement("ANALYZE foo WITH ( \"string\" = 'bar', \"long\" = 42, computed = concat('ban', 'ana'), a = ARRAY[ 'v1', 'v2' ] )", new Analyze(table, ImmutableList.of(new Property(new Identifier("string"), new StringLiteral("bar")), new Property(new Identifier("long"), new LongLiteral("42")), new Property(new Identifier("computed"), new FunctionCall(QualifiedName.of("concat"), ImmutableList.of(new StringLiteral("ban"), new StringLiteral("ana")))), new Property(new Identifier("a"), new ArrayConstructor(ImmutableList.of(new StringLiteral("v1"), new StringLiteral("v2")))))));
    assertStatement("EXPLAIN ANALYZE foo", new Explain(new Analyze(table, ImmutableList.of()), ImmutableList.of()));
    assertStatement("EXPLAIN ANALYZE ANALYZE foo", new ExplainAnalyze(new Analyze(table, ImmutableList.of()), false));
}
Also used : 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) ExplainAnalyze(io.trino.sql.tree.ExplainAnalyze) QualifiedName(io.trino.sql.tree.QualifiedName) Explain(io.trino.sql.tree.Explain) ArrayConstructor(io.trino.sql.tree.ArrayConstructor) FunctionCall(io.trino.sql.tree.FunctionCall) Property(io.trino.sql.tree.Property) ExplainAnalyze(io.trino.sql.tree.ExplainAnalyze) Analyze(io.trino.sql.tree.Analyze) Test(org.junit.jupiter.api.Test)

Aggregations

QueryUtil.quotedIdentifier (io.trino.sql.QueryUtil.quotedIdentifier)1 Analyze (io.trino.sql.tree.Analyze)1 ArrayConstructor (io.trino.sql.tree.ArrayConstructor)1 Explain (io.trino.sql.tree.Explain)1 ExplainAnalyze (io.trino.sql.tree.ExplainAnalyze)1 FunctionCall (io.trino.sql.tree.FunctionCall)1 Identifier (io.trino.sql.tree.Identifier)1 LongLiteral (io.trino.sql.tree.LongLiteral)1 Property (io.trino.sql.tree.Property)1 QualifiedName (io.trino.sql.tree.QualifiedName)1 StringLiteral (io.trino.sql.tree.StringLiteral)1 Test (org.junit.jupiter.api.Test)1