[ 
https://issues.apache.org/jira/browse/PHOENIX-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14159634#comment-14159634
 ] 

James Taylor commented on PHOENIX-1324:
---------------------------------------

Looking at this further, it'd make sense to set the setup the scan during the 
relevant compilation parts.  For example, this code in 
QueryCompiler.compileSingleQuery() can be moved above the ProjectionCompile:
{code}
        // Final step is to build the query plan
        int maxRows = statement.getMaxRows();
        if (maxRows > 0) {
            if (limit != null) {
                limit = Math.min(limit, maxRows);
            } else {
                limit = maxRows;
            }
        }
{code}
Then the code that adds a PageFilter can be included before the 
ProjectionCompile (so that we add the PageFilter). Then the ProjectionCompile 
can do the work done in ParallelIterators to optimize the scan projection.

That still leaves the code in BaseQueryCompiler.newIterators() that's setting 
up a bunch of state on the Scan. This code is executed for all query plans, so 
it could be moved either into different compilation phases or at the end of 
QueryCompiler.compileSingleQuery().

The downside of doing this refactoring is that we'll push a bunch of info to 
the Scan each time we try to compile the query for an index. We'd be better off 
separating this into two steps so that we only do this work on the final query 
plan.

> Consolidate code that initializes Scan
> --------------------------------------
>
>                 Key: PHOENIX-1324
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1324
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to