Search in sources :

Example 1 with ExplainFormat

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

the class TestSqlParser method testExplain.

@Test
public void testExplain() {
    assertStatement("EXPLAIN SELECT * FROM t", new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, false, ImmutableList.of()));
    assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t", new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, false, ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL))));
    assertStatement("EXPLAIN (TYPE LOGICAL, FORMAT TEXT) SELECT * FROM t", new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, false, ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL), new ExplainFormat(ExplainFormat.Type.TEXT))));
}
Also used : ExplainType(com.facebook.presto.sql.tree.ExplainType) ExplainFormat(com.facebook.presto.sql.tree.ExplainFormat) Explain(com.facebook.presto.sql.tree.Explain) AllColumns(com.facebook.presto.sql.tree.AllColumns) Test(org.testng.annotations.Test)

Example 2 with ExplainFormat

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

the class ExplainVerification method getQueryRewrite.

@Override
protected QueryBundle getQueryRewrite(ClusterType clusterType) {
    Statement statement = sqlParser.createStatement(getSourceQuery().getQuery(clusterType), PARSING_OPTIONS);
    Explain explain = new Explain(statement, false, false, ImmutableList.of(new ExplainFormat(JSON)));
    return new QueryBundle(ImmutableList.of(), explain, ImmutableList.of(), clusterType);
}
Also used : ExplainFormat(com.facebook.presto.sql.tree.ExplainFormat) Statement(com.facebook.presto.sql.tree.Statement) Explain(com.facebook.presto.sql.tree.Explain)

Aggregations

Explain (com.facebook.presto.sql.tree.Explain)2 ExplainFormat (com.facebook.presto.sql.tree.ExplainFormat)2 AllColumns (com.facebook.presto.sql.tree.AllColumns)1 ExplainType (com.facebook.presto.sql.tree.ExplainType)1 Statement (com.facebook.presto.sql.tree.Statement)1 Test (org.testng.annotations.Test)1