You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2014/10/05 02:58:33 UTC

[jira] [Commented] (PHOENIX-1315) Remove queryPlan.iterators() call in PhoenixInputFormat if not necessary

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

James Taylor commented on PHOENIX-1315:
---------------------------------------

The filter information is setup now on the List<List<Scan>> that is stored on ParallelIterators. We should add an access to this from QueryPlan and then use these scans. You can just flatten the list out and put each Scan into your PhoenixInputSplit (instead of the KeyRange). Then, when you want to execute the TableResultIterator, you can use that Scan directly (no need to do any further intersection).

> Remove queryPlan.iterators() call in PhoenixInputFormat if not necessary
> ------------------------------------------------------------------------
>
>                 Key: PHOENIX-1315
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1315
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: maghamravikiran
>             Fix For: 4.2, 3.2
>
>
> I came across this with a recent change I was making. Why is the call to queryPlan.iterators() necessary in PhoenixInputFormat?
> {code}
>     private QueryPlan getQueryPlan(final JobContext context) throws IOException {
>         Preconditions.checkNotNull(context);
>         if(queryPlan == null) {
>             try{
>                 final Connection connection = getConnection();
>                 final String selectStatement = getConf().getSelectStatement();
>                 Preconditions.checkNotNull(selectStatement);
>                 final Statement statement = connection.createStatement();
>                 final PhoenixStatement pstmt = statement.unwrap(PhoenixStatement.class);
>                 this.queryPlan = pstmt.compileQuery(selectStatement);
>                 // FIXME: why is getting the iterator necessary here, as it will
>                 // cause the query to run.
>                 this.queryPlan.iterator();
>             } catch(Exception exception) {
>                 LOG.error(String.format("Failed to get the query plan with error [%s]",exception.getMessage()));
>                 throw new RuntimeException(exception);
>             }
>         }
>         return queryPlan;
>     }
> {code}



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