/** * Return true if the region with the start and end key * intersects with the scan ranges and false otherwise. * @param regionStartKey lower inclusive key * @param regionEndKey upper exclusive key * @param isLocalIndex true if the table being scanned is a local index * @return true if the scan range intersects with the specified lower/upper key * range */ public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } // Every range intersects all regions of a local index table if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; }
private static void assertIntersect(ScanRanges ranges, String lowerRange, String upperRange, String... expectedPoints) { List<KeyRange> expectedKeys = points(expectedPoints); Collections.sort(expectedKeys,KeyRange.COMPARATOR); Scan scan = new Scan(); scan.setFilter(ranges.getSkipScanFilter()); byte[] startKey = lowerRange == null ? KeyRange.UNBOUND : PVarchar.INSTANCE.toBytes(lowerRange); byte[] stopKey = upperRange == null ? KeyRange.UNBOUND : PVarchar.INSTANCE.toBytes(upperRange); Scan newScan = ranges.intersectScan(scan, startKey, stopKey, 0, true); if (expectedPoints.length == 0) { assertNull(newScan); } else { assertNotNull(newScan); SkipScanFilter filter = (SkipScanFilter)newScan.getFilter(); assertEquals(expectedKeys, filter.getSlots().get(0)); } }
boolean everNotDelayed = false; while (intersectWithGuidePosts && (endKey.length == 0 || (gpsComparedToEndKey=currentGuidePost.compareTo(endKey)) <= 0)) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, false); if (newScan != null) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, endKey, keyOffset, true); if(newScan != null) { ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(),
/** * Return true if the region with the start and end key * intersects with the scan ranges and false otherwise. * @param regionStartKey lower inclusive key * @param regionEndKey upper exclusive key * @param isLocalIndex true if the table being scanned is a local index * @return true if the scan range intersects with the specified lower/upper key * range */ public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } // Every range intersects all regions of a local index table if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; }
/** * Return true if the region with the start and end key * intersects with the scan ranges and false otherwise. * @param regionStartKey lower inclusive key * @param regionEndKey upper exclusive key * @param isLocalIndex true if the table being scanned is a local index * @return true if the scan range intersects with the specified lower/upper key * range */ public boolean intersectRegion(byte[] regionStartKey, byte[] regionEndKey, boolean isLocalIndex) { if (isEverything()) { return true; } if (isDegenerate()) { return false; } // Every range intersects all regions of a local index table if (isLocalIndex) { return true; } boolean crossesSaltBoundary = isSalted && ScanUtil.crossesPrefixBoundary(regionEndKey, ScanUtil.getPrefix(regionStartKey, SaltingUtil.NUM_SALTING_BYTES), SaltingUtil.NUM_SALTING_BYTES); return intersectScan(null, regionStartKey, regionEndKey, 0, crossesSaltBoundary) == HAS_INTERSECTION; }
boolean everNotDelayed = false; while (intersectWithGuidePosts && (endKey.length == 0 || (gpsComparedToEndKey=currentGuidePost.compareTo(endKey)) <= 0)) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, false); if (newScan != null) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, endKey, keyOffset, true); if(newScan != null) { ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(),
boolean everNotDelayed = false; while (intersectWithGuidePosts && (endKey.length == 0 || (gpsComparedToEndKey=currentGuidePost.compareTo(endKey)) <= 0)) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, false); if (newScan != null) { Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, endKey, keyOffset, true); if(newScan != null) { ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(),