Search in sources :

Example 1 with Analyze

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

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(com.facebook.presto.sql.tree.Identifier) QueryUtil.quotedIdentifier(com.facebook.presto.sql.QueryUtil.quotedIdentifier) StringLiteral(com.facebook.presto.sql.tree.StringLiteral) LongLiteral(com.facebook.presto.sql.tree.LongLiteral) QualifiedName(com.facebook.presto.sql.tree.QualifiedName) Explain(com.facebook.presto.sql.tree.Explain) ArrayConstructor(com.facebook.presto.sql.tree.ArrayConstructor) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) Property(com.facebook.presto.sql.tree.Property) Analyze(com.facebook.presto.sql.tree.Analyze) Test(org.testng.annotations.Test)

Aggregations

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