Package com.facebook.presto.sql.tree

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


    protected TupleDescriptor visitShowTables(ShowTables showTables, AnalysisContext context)
    {
        String catalogName = session.getCatalog();
        String schemaName = session.getSchema();

        QualifiedName schema = showTables.getSchema();
        if (schema != null) {
            List<String> parts = schema.getParts();
            if (parts.size() > 2) {
                throw new SemanticException(INVALID_SCHEMA_NAME, showTables, "too many parts in schema name: %s", schema);
            }
            if (parts.size() == 2) {
                catalogName = parts.get(0);
            }
            schemaName = schema.getSuffix();
        }

        // TODO: throw SemanticException if schema does not exist

        Expression predicate = equal(nameReference("table_schema"), new StringLiteral(schemaName));
View Full Code Here


        // For a query like "SELECT * FROM T GROUP BY a", groupByExpressions will contain "a",
        // and the '*' will be expanded to Field references. Therefore we translate all simple name expressions
        // in the group by clause to fields they reference so that the expansion from '*' can be matched against them
        for (Expression expression : Iterables.filter(expressions, instanceOf(QualifiedNameReference.class))) {
            QualifiedName name = ((QualifiedNameReference) expression).getName();

            List<Integer> fieldIndexes = tupleDescriptor.resolveFieldIndexes(name);
            Preconditions.checkState(fieldIndexes.size() <= 1, "Found more than one field for name '%s': %s", name, fieldIndexes);

            if (fieldIndexes.size() == 1) {
View Full Code Here

        }

        @Override
        protected Boolean visitQualifiedNameReference(QualifiedNameReference node, Void context)
        {
            QualifiedName name = node.getName();

            List<Integer> indexes = tupleDescriptor.resolveFieldIndexes(name);
            Preconditions.checkState(!indexes.isEmpty(), "No fields for name '%s'", name);
            Preconditions.checkState(indexes.size() <= 1, "Found more than one field for name '%s': %s", name, indexes);
View Full Code Here

                FieldOrExpression orderByExpression = null;
                if (expression instanceof QualifiedNameReference && !((QualifiedNameReference) expression).getName().getPrefix().isPresent()) {
                    // if this is a simple name reference, try to resolve against output columns

                    QualifiedName name = ((QualifiedNameReference) expression).getName();
                    Collection<Expression> expressions = byAlias.get(name);
                    if (expressions.size() > 1) {
                        throw new SemanticException(AMBIGUOUS_ATTRIBUTE, expression, "'%s' in ORDER BY is ambiguous", name.getSuffix());
                    }
                    else if (expressions.size() == 1) {
                        orderByExpression = new FieldOrExpression(Iterables.getOnlyElement(expressions));
                    }
View Full Code Here

                FieldOrExpression orderByExpression = null;
                if (expression instanceof QualifiedNameReference && !((QualifiedNameReference) expression).getName().getPrefix().isPresent()) {
                    // if this is a simple name reference, try to resolve against output columns

                    QualifiedName name = ((QualifiedNameReference) expression).getName();
                    Collection<Expression> expressions = byAlias.get(name);
                    if (expressions.size() > 1) {
                        throw new SemanticException(AMBIGUOUS_ATTRIBUTE, expression, "'%s' in ORDER BY is ambiguous", name.getSuffix());
                    }
                    else if (expressions.size() == 1) {
                        orderByExpression = new FieldOrExpression(Iterables.getOnlyElement(expressions));
                    }
View Full Code Here

    protected TupleDescriptor visitShowTables(ShowTables showTables, AnalysisContext context)
    {
        String catalogName = session.getCatalog();
        String schemaName = session.getSchema();

        QualifiedName schema = showTables.getSchema();
        if (schema != null) {
            List<String> parts = schema.getParts();
            if (parts.size() > 2) {
                throw new SemanticException(INVALID_SCHEMA_NAME, showTables, "too many parts in schema name: %s", schema);
            }
            if (parts.size() == 2) {
                catalogName = parts.get(0);
            }
            schemaName = schema.getSuffix();
        }

        // TODO: throw SemanticException if schema does not exist

        Expression predicate = equal(nameReference("table_schema"), new StringLiteral(schemaName));
View Full Code Here

    }

    @Override
    public InternalAggregationFunction getFunction()
    {
        return metadata.resolveFunction(new QualifiedName("var_pop"), ImmutableList.<Type>of(BIGINT), false).getAggregationFunction();
    }
View Full Code Here

    }

    @Override
    public InternalAggregationFunction getFunction()
    {
        return metadata.resolveFunction(new QualifiedName("stddev"), ImmutableList.<Type>of(DOUBLE), false).getAggregationFunction();
    }
View Full Code Here

    }

    @Override
    public InternalAggregationFunction getFunction()
    {
        return metadata.resolveFunction(new QualifiedName("variance"), ImmutableList.<Type>of(BIGINT), false).getAggregationFunction();
    }
View Full Code Here

    }

    @Override
    public InternalAggregationFunction getFunction()
    {
        return metadata.resolveFunction(new QualifiedName("stddev_pop"), ImmutableList.<Type>of(BIGINT), false).getAggregationFunction();
    }
View Full Code Here

TOP

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

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.