dbwong commented on a change in pull request #463: Phoenix stats Initial Commit
URL: https://github.com/apache/phoenix/pull/463#discussion_r265838651
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
##########
@@ -550,6 +550,76 @@ 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.newArrayListWithExpectedSize(regionLocations.size());
+
+ //Map each HRegionLocation to a KeyRange - no Java 8
+ for(HRegionLocation regionLocation : regionLocations){
+ HRegionInfo regionInfo = regionLocation.getRegionInfo();
+
+ //Region is upperInclusive false by definition
+ KeyRange range = KeyRange.getKeyRange(regionInfo.getStartKey(),
true, regionInfo.getEndKey(), false);
+ regionKeyRanges.add(range);
+ }
+ return regionKeyRanges;
+ }
+
+ List<List<KeyRange>> getQueryRowKeyRanges(List<KeyRange> regionKeyRanges) {
+ ScanRanges scanRanges = context.getScanRanges();
+
+ RowKeySchema schema = scanRanges.getSchema();
+
+ PTable table = getTable();
+ boolean isLocalIndex = table.getIndexType() == IndexType.LOCAL;
+
+ //Use the dataplan to build the queryRowKeyRanges
+ if (isLocalIndex) {
+ // should always have a data plan when a local index is being used.
+ if (dataPlan != null && dataPlan.getTableRef().getTable().getType()
+ != PTableType.INDEX) { // Sanity check
+ scanRanges =
+
computePrefixScanRanges(dataPlan.getContext().getScanRanges(),
+ computeColumnsInCommon());
+ }
+ }
+
+ List<KeyRange> queryRowKeyRanges = scanRanges.getRowKeyRanges();
+
+ if(isLocalIndex){
+ List<KeyRange> newQueryRowKeyRanges =
Lists.newArrayListWithExpectedSize(queryRowKeyRanges.size() *
regionKeyRanges.size());
+
+ for(KeyRange regionKeyRange : regionKeyRanges) {
Review comment:
Done
----------------------------------------------------------------
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