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

    https://github.com/apache/phoenix/pull/156#discussion_r58483157
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java ---
    @@ -209,7 +209,11 @@ protected ResultIterator 
newIterator(ParallelScanGrouper scanGrouper) throws SQL
             if (isOrdered) {
                 scanner = new MergeSortTopNResultIterator(iterators, limit, 
orderBy.getOrderByExpressions());
             } else {
    -            if ((isSalted || table.getIndexType() == IndexType.LOCAL) && 
ScanUtil.shouldRowsBeInRowKeyOrder(orderBy, context)) {
    +            if ((isSalted || table.getIndexType() == IndexType.LOCAL)
    +                    && ScanUtil.shouldRowsBeInRowKeyOrder(orderBy, context)
    +                    || (table.getIndexType() == IndexType.LOCAL && 
(Bytes.compareTo(
    +                        scan.getStartRow(), 
this.context.getScan().getStartRow()) != 0 || Bytes
    +                            .compareTo(scan.getStopRow(), 
this.context.getScan().getStopRow()) != 0))) {
    --- End diff --
    
    Why is  a merge sort required for this new condition? Is this the case when 
the original start/stop row has changed? Is this purely for the chunked result 
iterator case? Let's document this and add a TODO to remove as the chunked 
result iterator is deprecated (and if you could consistently add this TODO for 
other parts of code only necessary due to this deprecated chunking mechanism, 
that'd be much appreciated).


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to