karanmehta93 commented on a change in pull request #463: Phoenix stats Initial
Commit
URL: https://github.com/apache/phoenix/pull/463#discussion_r272298475
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
##########
@@ -550,15 +550,48 @@ public BaseResultIterators(QueryPlan plan, Integer
perScanLimit, Integer offset,
}
return ranges;
}
-
+
+ private List<KeyRange> getRegionRowKeyRanges() throws SQLException {
+ List<HRegionLocation> regionLocations =
getRegionBoundaries(scanGrouper); // Load the region information
+
+ List<KeyRange> regionKeyRanges =
Lists.newArrayListWithCapacity(regionLocations.size());
+
+ // Map each HRegionLocation to a KeyRange - no Java 8
+ for (int i = 0; i < regionLocations.size(); i++) {
+ HRegionLocation regionLocation = regionLocations.get(i);
+ HRegionInfo regionInfo = regionLocation.getRegionInfo();
+
+ // Region is lowerInclusive true by definition
+ byte[] startKey = regionInfo.getStartKey();
+ boolean lowerInclusive = true;
+ // The first region has an unbound lower key.
+ if (i == 0) {
+ startKey = KeyRange.UNBOUND;
+ lowerInclusive = false;
+ }
+
+ // Region is upperInclusive false by definition
+ byte[] endKey = regionInfo.getEndKey();
+ // The last region has an unbound upper key.
+ if (i == regionLocations.size() - 1) {
+ endKey = KeyRange.UNBOUND;
+ }
+
+ KeyRange range = KeyRange.getKeyRange(startKey, lowerInclusive,
regionInfo.getEndKey(), false);
Review comment:
Looks like it should not really matter since `KeyRange.UNBOUND` and
`HConstants.EMPTY_BYTE_ARRAY` are the same. Should we just refactor these
static constants? Some of this code exists from 2014. You can also remove line
56 if you want.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services