Package com.facebook.presto.sql.tree

Examples of com.facebook.presto.sql.tree.Query


        if (likePattern != null) {
            Expression likePredicate = new LikePredicate(nameReference("table_name"), new StringLiteral(likePattern), null);
            predicate = logicalAnd(predicate, likePredicate);
        }

        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(aliasedName("table_name", "Table")),
                        table(QualifiedName.of(catalogName, TABLE_TABLES.getSchemaName(), TABLE_TABLES.getTableName())),
                        Optional.of(predicate),
View Full Code Here


    }

    @Override
    protected TupleDescriptor visitShowSchemas(ShowSchemas node, AnalysisContext context)
    {
        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(aliasedName("schema_name", "Schema")),
                        table(QualifiedName.of(node.getCatalog().or(session.getCatalog()), TABLE_SCHEMATA.getSchemaName(), TABLE_SCHEMATA.getTableName())),
                        Optional.<Expression>absent(),
View Full Code Here

    }

    @Override
    protected TupleDescriptor visitShowCatalogs(ShowCatalogs node, AnalysisContext context)
    {
        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(aliasedName("catalog_name", "Catalog")),
                        table(QualifiedName.of(session.getCatalog(), CATALOG_TABLE_NAME.getSchemaName(), CATALOG_TABLE_NAME.getTableName())),
                        Optional.<Expression>absent(),
View Full Code Here

        if (!metadata.getTableHandle(tableName).isPresent()) {
            throw new SemanticException(MISSING_TABLE, showColumns, "Table '%s' does not exist", tableName);
        }

        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(
                                aliasedName("column_name", "Column"),
                                aliasedName("data_type", "Type"),
View Full Code Here

            Expression function = functionCall("max", value);
            selectList.add(new SingleColumn(function, column.getName()));
            wrappedList.add(unaliasedName(column.getName()));
        }

        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectAll(selectList.build()),
                        table(QualifiedName.of(table.getCatalogName(), TABLE_INTERNAL_PARTITIONS.getSchemaName(), TABLE_INTERNAL_PARTITIONS.getTableName())),
                        Optional.of(logicalAnd(
                                equal(nameReference("table_schema"), new StringLiteral(table.getSchemaName())),
                                equal(nameReference("table_name"), new StringLiteral(table.getTableName())))),
                        ImmutableList.of(nameReference("partition_number")),
                        Optional.<Expression>absent(),
                        ImmutableList.<SortItem>of(),
                        Optional.<String>absent()),
                ImmutableList.<SortItem>of(),
                Optional.<String>absent());

        query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectAll(wrappedList.build()),
                        subquery(query),
                        showPartitions.getWhere(),
View Full Code Here

    }

    @Override
    protected TupleDescriptor visitShowFunctions(ShowFunctions node, AnalysisContext context)
    {
        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(
                                aliasedName("function_name", "Function"),
                                aliasedName("return_type", "Return Type"),
View Full Code Here

    @Test
    public void testDoubleInQuery()
    {
        assertStatement("SELECT 123.456E7 FROM DUAL",
                new Query(
                        Optional.<With>absent(),
                        new QuerySpecification(
                                selectList(new DoubleLiteral("123.456E7")),
                                table(QualifiedName.of("DUAL")),
                                Optional.<Expression>absent(),
View Full Code Here

    }

    @Override
    protected RelationPlan visitTable(Table node, Void context)
    {
        Query namedQuery = analysis.getNamedQuery(node);
        if (namedQuery != null) {
            RelationPlan subPlan = process(namedQuery, null);
            return new RelationPlan(subPlan.getRoot(), analysis.getOutputDescriptor(node), subPlan.getOutputSymbols());
        }
View Full Code Here

        if (likePattern != null) {
            Expression likePredicate = new LikePredicate(nameReference("table_name"), new StringLiteral(likePattern), null);
            predicate = logicalAnd(predicate, likePredicate);
        }

        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(aliasedName("table_name", "Table")),
                        table(QualifiedName.of(catalogName, TABLE_TABLES.getSchemaName(), TABLE_TABLES.getTableName())),
                        Optional.of(predicate),
View Full Code Here

    }

    @Override
    protected TupleDescriptor visitShowSchemas(ShowSchemas node, AnalysisContext context)
    {
        Query query = new Query(
                Optional.<With>absent(),
                new QuerySpecification(
                        selectList(aliasedName("schema_name", "Schema")),
                        table(QualifiedName.of(node.getCatalog().or(session.getCatalog()), TABLE_SCHEMATA.getSchemaName(), TABLE_SCHEMATA.getTableName())),
                        Optional.<Expression>absent(),
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.tree.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.