Search in sources :

Example 1 with ShowStats

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

the class AstBuilder method visitShowStatsForQuery.

@Override
public Node visitShowStatsForQuery(SqlBaseParser.ShowStatsForQueryContext context) {
    QuerySpecification specification = (QuerySpecification) visitQuerySpecification(context.querySpecification());
    Query query = new Query(Optional.empty(), specification, Optional.empty(), Optional.empty(), Optional.empty());
    return new ShowStats(Optional.of(getLocation(context)), new TableSubquery(query));
}
Also used : QuerySpecification(com.facebook.presto.sql.tree.QuerySpecification) Query(com.facebook.presto.sql.tree.Query) WithQuery(com.facebook.presto.sql.tree.WithQuery) ShowStats(com.facebook.presto.sql.tree.ShowStats) TableSubquery(com.facebook.presto.sql.tree.TableSubquery)

Example 2 with ShowStats

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

the class TestSqlParser method testShowStats.

@Test
public void testShowStats() {
    final String[] tableNames = { "t", "s.t", "c.s.t" };
    for (String fullName : tableNames) {
        QualifiedName qualifiedName = makeQualifiedName(fullName);
        assertStatement(format("SHOW STATS FOR %s", qualifiedName), new ShowStats(new Table(qualifiedName)));
    }
}
Also used : CreateTable(com.facebook.presto.sql.tree.CreateTable) DropTable(com.facebook.presto.sql.tree.DropTable) Table(com.facebook.presto.sql.tree.Table) RenameTable(com.facebook.presto.sql.tree.RenameTable) ShowStats(com.facebook.presto.sql.tree.ShowStats) QualifiedName(com.facebook.presto.sql.tree.QualifiedName) Test(org.testng.annotations.Test)

Aggregations

ShowStats (com.facebook.presto.sql.tree.ShowStats)2 CreateTable (com.facebook.presto.sql.tree.CreateTable)1 DropTable (com.facebook.presto.sql.tree.DropTable)1 QualifiedName (com.facebook.presto.sql.tree.QualifiedName)1 Query (com.facebook.presto.sql.tree.Query)1 QuerySpecification (com.facebook.presto.sql.tree.QuerySpecification)1 RenameTable (com.facebook.presto.sql.tree.RenameTable)1 Table (com.facebook.presto.sql.tree.Table)1 TableSubquery (com.facebook.presto.sql.tree.TableSubquery)1 WithQuery (com.facebook.presto.sql.tree.WithQuery)1 Test (org.testng.annotations.Test)1