You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by karanmehta93 <gi...@git.apache.org> on 2018/09/18 21:09:14 UTC
[GitHub] phoenix pull request #347: PHOENIX-4594: Perform binary search on guideposts...
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`
---