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

ASF GitHub Bot commented on PHOENIX-4594:
-----------------------------------------

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

    https://github.com/apache/phoenix/pull/347#discussion_r218595912
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java 
---
    @@ -972,32 +977,84 @@ private static boolean clipKeyRangeBytes(RowKeySchema 
schema, int fieldIndex, in
                     decoder = new PrefixByteDecoder(gps.getMaxLength());
                     firstRegionStartKey = new 
ImmutableBytesWritable(regionLocations.get(regionIndex).getRegionInfo().getStartKey());
                     try {
    -                    int c;
    -                    // Continue walking guideposts until we get past the 
currentKey
    -                    while ((c=currentKey.compareTo(currentGuidePost = 
PrefixByteCodec.decode(decoder, input))) >= 0) {
    -                        // Detect if we found a guidepost that might be in 
the first region. This
    -                        // is for the case where the start key may be past 
the only guidepost in
    -                        // the first region.
    -                        if (!gpsForFirstRegion && 
firstRegionStartKey.compareTo(currentGuidePost) <= 0) {
    -                            gpsForFirstRegion = true;
    +                    if (firstRegionStartKey.getLength() > 0 && 
this.gpsMovingWindowSize > 0) {
    +                        // Continuously decode and load guide posts in 
batches (moving window). For each moving window,
    +                        // firstly compare the searching key with the last 
element to see whether the searching key is
    +                        // in the current window. If it isn't, perform 
binary search in the window; otherwise, move to
    --- End diff --
    
    nit: `If it is`


> Perform binary search on guideposts during query compilation
> ------------------------------------------------------------
>
>                 Key: PHOENIX-4594
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4594
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: James Taylor
>            Assignee: Bin Shi
>            Priority: Major
>         Attachments: PHOENIX-4594-0913.patch, PHOENIX-4594_0917.patch, 
> PHOENIX-4594_0918.patch
>
>
> If there are many guideposts, performance will suffer during query 
> compilation because we do a linear search of the guideposts to find the 
> intersection with the scan ranges. Instead, in 
> BaseResultIterators.getParallelScans() we should populate an array of 
> guideposts and perform a binary search. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to