Examples of QueryCompiler


Examples of org.apache.phoenix.compile.QueryCompiler

    public QueryPlan optimize(SelectStatement select, PhoenixStatement statement) throws SQLException {
        return optimize(select, statement, Collections.<PColumn>emptyList(), null);
    }

    public QueryPlan optimize(SelectStatement select, PhoenixStatement statement, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory) throws SQLException {
        QueryCompiler compiler = new QueryCompiler(statement, targetColumns, parallelIteratorFactory);
        QueryPlan dataPlan = compiler.compile(select);
        if (!useIndexes) {
            return dataPlan;
        }
        // Get the statement as it's been normalized now
        // TODO: the recompile for the index tables could skip the normalize step
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        String tableName = '"' + index.getTableName().getString() + '"';
        List<? extends TableNode> tables = Collections.singletonList(FACTORY.namedTable(alias, FACTORY.table(schemaName, tableName)));
        try {
            SelectStatement indexSelect = FACTORY.select(select, tables);           
            QueryCompiler compiler = new QueryCompiler(statement, targetColumns, parallelIteratorFactory);
            QueryPlan plan = compiler.compile(indexSelect);
            // Checking the index status and number of columns handles the wildcard cases correctly
            // We can't check the status earlier, because the index table may be out-of-date.
            if (plan.getTableRef().getTable().getIndexState() == PIndexState.ACTIVE && plan.getProjector().getColumnCount() == nColumns) {
                plans.add(plan);
                return true;
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select) throws SQLException {
        return optimize(statement, select, FromCompiler.getResolverForQuery(select, statement.getConnection()), Collections.<PColumn>emptyList(), null);
    }

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select, ColumnResolver resolver, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory) throws SQLException {
        QueryCompiler compiler = new QueryCompiler(statement, select, resolver, targetColumns, parallelIteratorFactory);
        QueryPlan dataPlan = compiler.compile();
        return optimize(dataPlan, statement, targetColumns, parallelIteratorFactory);
    }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        try {
            SelectStatement indexSelect = FACTORY.select(select, tables);
            ColumnResolver resolver = FromCompiler.getResolverForQuery(indexSelect, statement.getConnection());
            // Check index state of now potentially updated index table to make sure it's active
            if (PIndexState.ACTIVE.equals(resolver.getTables().get(0).getTable().getIndexState())) {
                QueryCompiler compiler = new QueryCompiler(statement, indexSelect, resolver, targetColumns, parallelIteratorFactory);
                QueryPlan plan = compiler.compile();
                // Checking number of columns handles the wildcard cases correctly, as in that case the index
                // must contain all columns from the data table to be able to be used.
                if (plan.getTableRef().getTable().getIndexState() == PIndexState.ACTIVE && plan.getProjector().getColumnCount() == nColumns) {
                    return plan;
                }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select) throws SQLException {
        return optimize(statement, select, FromCompiler.getResolverForQuery(select, statement.getConnection()), Collections.<PColumn>emptyList(), null);
    }

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select, ColumnResolver resolver, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory) throws SQLException {
        QueryCompiler compiler = new QueryCompiler(statement, select, resolver, targetColumns, parallelIteratorFactory, new SequenceManager(statement));
        QueryPlan dataPlan = compiler.compile();
        return optimize(dataPlan, statement, targetColumns, parallelIteratorFactory);
    }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        try {
            SelectStatement indexSelect = FACTORY.select(select, tables);
            ColumnResolver resolver = FromCompiler.getResolverForQuery(indexSelect, statement.getConnection());
            // Check index state of now potentially updated index table to make sure it's active
            if (PIndexState.ACTIVE.equals(resolver.getTables().get(0).getTable().getIndexState())) {
                QueryCompiler compiler = new QueryCompiler(statement, indexSelect, resolver, targetColumns, parallelIteratorFactory, dataPlan.getContext().getSequenceManager());
                QueryPlan plan = compiler.compile();
                // If query doesn't have where clause and some of columns to project are missing
                // in the index then we need to get missing columns from main table for each row in
                // local index. It's like full scan of both local index and data table which is inefficient.
                // Then we don't use the index. If all the columns to project are present in the index
                // then we can use the index even the query doesn't have where clause.
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        @Override
        public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException {
            SelectStatement select = SubselectRewriter.flatten(this, stmt.getConnection());
            ColumnResolver resolver = FromCompiler.getResolverForQuery(select, stmt.getConnection());
            select = StatementNormalizer.normalize(select, resolver);
            QueryPlan plan = new QueryCompiler(stmt, select, resolver).compile();
            plan.getContext().getSequenceManager().validateSequences(seqAction);
            return plan;
        }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        @SuppressWarnings("unchecked")
        @Override
        public QueryPlan compilePlan(PhoenixStatement stmt) throws SQLException {
            ColumnResolver resolver = FromCompiler.getResolverForQuery(this, stmt.getConnection());
            SelectStatement select = StatementNormalizer.normalize(this, resolver);
            return new QueryCompiler(stmt, select, resolver).compile();
        }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select) throws SQLException {
        return optimize(statement, select, FromCompiler.getResolverForQuery(select, statement.getConnection()), Collections.<PColumn>emptyList(), null);
    }

    public QueryPlan optimize(PhoenixStatement statement, SelectStatement select, ColumnResolver resolver, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory) throws SQLException {
        QueryCompiler compiler = new QueryCompiler(statement, select, resolver, targetColumns, parallelIteratorFactory);
        QueryPlan dataPlan = compiler.compile();
        return optimize(dataPlan, statement, targetColumns, parallelIteratorFactory);
    }
View Full Code Here

Examples of org.apache.phoenix.compile.QueryCompiler

        try {
            SelectStatement indexSelect = FACTORY.select(select, tables);
            ColumnResolver resolver = FromCompiler.getResolverForQuery(indexSelect, statement.getConnection());
            // Check index state of now potentially updated index table to make sure it's active
            if (PIndexState.ACTIVE.equals(resolver.getTables().get(0).getTable().getIndexState())) {
                QueryCompiler compiler = new QueryCompiler(statement, indexSelect, resolver, targetColumns, parallelIteratorFactory);
                QueryPlan plan = compiler.compile();
                // Checking number of columns handles the wildcard cases correctly, as in that case the index
                // must contain all columns from the data table to be able to be used.
                if (plan.getTableRef().getTable().getIndexState() == PIndexState.ACTIVE && plan.getProjector().getColumnCount() == nColumns) {
                    return plan;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.