Github user maryannxue commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/224#discussion_r91155610
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
 ---
    @@ -73,13 +70,10 @@ public QueryPlan implement(PhoenixRelImplementor 
implementor) {
             QueryPlan plan = implementor.visitInput(0, (PhoenixQueryRel) 
getInput());
             implementor.popContext();
             
    -        
    -        PhoenixSequence sequence = CalciteUtils.findSequence(this);
    -        final SequenceManager seqManager = sequence == null ?
    -                null : new SequenceManager(new 
PhoenixStatement(sequence.pc));
    -        implementor.setSequenceManager(seqManager);
    -        TupleProjector tupleProjector = project(implementor);
    -        if (seqManager != null) {
    +
    --- End diff --
    
    This entire wrapping logic should live in PhoenixToEnumerableConverter 
instead. Wrapping it with an iterator not a query plan would be better, 
something like:
    {code}
    
            return new DelegateQueryPlan((QueryPlan) plan) {
                @Override
                public ResultIterator iterator() throws SQLException {
                    ResultIterator iterator = 
iterator(DefaultParallelScanGrouper.getInstance());
                    if 
(phoenixImplementor.getSequenceManager().getSequenceCount() > 0) {
                        iterator = new SequenceResultIterator(iterator, 
phoenixImplementor.getSequenceManager());
                    }
                    return iterator;
                }
                @Override
                public ExplainPlan getExplainPlan() throws SQLException {
    {code}


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to