Search in sources :

Example 1 with Analyze

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

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()), false, false, ImmutableList.of()));
    assertStatement("EXPLAIN ANALYZE ANALYZE foo", new Explain(new Analyze(table, ImmutableList.of()), true, false, ImmutableList.of()));
}
Also used : Identifier(io.prestosql.sql.tree.Identifier) QueryUtil.quotedIdentifier(io.prestosql.sql.QueryUtil.quotedIdentifier) StringLiteral(io.prestosql.sql.tree.StringLiteral) LongLiteral(io.prestosql.sql.tree.LongLiteral) QualifiedName(io.prestosql.sql.tree.QualifiedName) Explain(io.prestosql.sql.tree.Explain) ArrayConstructor(io.prestosql.sql.tree.ArrayConstructor) FunctionCall(io.prestosql.sql.tree.FunctionCall) Property(io.prestosql.sql.tree.Property) Analyze(io.prestosql.sql.tree.Analyze) Test(org.testng.annotations.Test)

Aggregations

QueryUtil.quotedIdentifier (io.prestosql.sql.QueryUtil.quotedIdentifier)1 Analyze (io.prestosql.sql.tree.Analyze)1 ArrayConstructor (io.prestosql.sql.tree.ArrayConstructor)1 Explain (io.prestosql.sql.tree.Explain)1 FunctionCall (io.prestosql.sql.tree.FunctionCall)1 Identifier (io.prestosql.sql.tree.Identifier)1 LongLiteral (io.prestosql.sql.tree.LongLiteral)1 Property (io.prestosql.sql.tree.Property)1 QualifiedName (io.prestosql.sql.tree.QualifiedName)1 StringLiteral (io.prestosql.sql.tree.StringLiteral)1 Test (org.testng.annotations.Test)1