Search in sources :

Example 1 with ExplainType

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

the class TestSqlParser method testExplain.

@Test
public void testExplain() {
    assertStatement("EXPLAIN SELECT * FROM t", new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), ImmutableList.of()));
    assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t", new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), 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"))), ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL), new ExplainFormat(ExplainFormat.Type.TEXT))));
    assertStatementIsInvalid("EXPLAIN VERBOSE SELECT * FROM t").withMessageStartingWith("line 1:9: mismatched input 'VERBOSE'. Expecting: '(', 'ALTER', 'ANALYZE', 'CALL',");
    assertStatementIsInvalid("EXPLAIN VERBOSE (type LOGICAL) SELECT * FROM t").withMessageStartingWith("line 1:9: mismatched input 'VERBOSE'. Expecting: '(', 'ALTER', 'ANALYZE', 'CALL',");
}
Also used : ExplainType(io.trino.sql.tree.ExplainType) ExplainFormat(io.trino.sql.tree.ExplainFormat) Explain(io.trino.sql.tree.Explain) AllColumns(io.trino.sql.tree.AllColumns) Test(org.junit.jupiter.api.Test)

Aggregations

AllColumns (io.trino.sql.tree.AllColumns)1 Explain (io.trino.sql.tree.Explain)1 ExplainFormat (io.trino.sql.tree.ExplainFormat)1 ExplainType (io.trino.sql.tree.ExplainType)1 Test (org.junit.jupiter.api.Test)1