phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [1/3] phoenix git commit: PHOENIX-2702 Show estimate rows and bytes touched in explain plan.
Date Mon, 22 Feb 2016 06:33:43 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 b6c8b8ec5 -> 8a1aa2e52
  refs/heads/4.x-HBase-1.0 48f0af5df -> d15743018
  refs/heads/master d9d66ae80 -> e4acd0cda


PHOENIX-2702 Show estimate rows and bytes touched in explain plan.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e4acd0cd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e4acd0cd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e4acd0cd

Branch: refs/heads/master
Commit: e4acd0cda4ad8f12db8331af39a9e32f4b81c223
Parents: d9d66ae
Author: Lars Hofhansl <larsh@apache.org>
Authored: Sun Feb 21 22:32:09 2016 -0800
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Sun Feb 21 22:32:09 2016 -0800

----------------------------------------------------------------------
 .../apache/phoenix/iterate/BaseResultIterators.java   | 14 +++++++++++++-
 .../java/org/apache/phoenix/iterate/ExplainTable.java |  2 +-
 .../phoenix/schema/stats/GuidePostsInfoBuilder.java   |  2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index 01b790a..fc3edbe 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -120,6 +120,8 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
     private final ParallelScanGrouper scanGrouper;
     // TODO: too much nesting here - breakup into new classes.
     private final List<List<List<Pair<Scan,Future<PeekingResultIterator>>>>>
allFutures;
+    private long estimatedRows;
+    private long estimatedSize;
     
     static final Function<HRegionLocation, KeyRange> TO_KEY_RANGE = new Function<HRegionLocation,
KeyRange>() {
         @Override
@@ -558,6 +560,8 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
                 while (guideIndex < gpsSize && (currentGuidePost.compareTo(endKey)
<= 0 || endKey.length == 0)) {
                     Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes,
keyOffset,
                             false);
+                    estimatedRows += gps.getRowCounts().get(guideIndex);
+                    estimatedSize += gps.getByteCounts().get(guideIndex);
                     scans = addNewScan(parallelScans, scans, newScan, currentGuidePostBytes,
false, regionLocation);
                     currentKeyBytes = currentGuidePost.copyBytes();
                     currentGuidePost = PrefixByteCodec.decode(decoder, input);
@@ -851,7 +855,15 @@ public abstract class BaseResultIterators extends ExplainTable implements
Result
                 QueryServices.EXPLAIN_CHUNK_COUNT_ATTRIB,
                 QueryServicesOptions.DEFAULT_EXPLAIN_CHUNK_COUNT);
         StringBuilder buf = new StringBuilder();
-        buf.append("CLIENT " + (displayChunkCount ? (this.splits.size() + "-CHUNK ") : "")
+ getName() + " " + size() + "-WAY ");
+        buf.append("CLIENT ");
+        if (displayChunkCount) {
+            buf.append(this.splits.size()).append("-CHUNK ");
+            if (estimatedRows > 0) {
+                buf.append(estimatedRows).append(" ROWS ");
+                buf.append(estimatedSize).append(" BYTES ");
+            }
+        }
+        buf.append(getName()).append(" ").append(size()).append("-WAY ");
         explain(buf.toString(),planSteps);
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
index b319914..1b623a4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
@@ -120,7 +120,7 @@ public abstract class ExplainTable {
         } else {
             explainSkipScan(buf);
         }
-        buf.append("OVER " + tableRef.getTable().getPhysicalName().getString());
+        buf.append("OVER ").append(tableRef.getTable().getPhysicalName().getString());
         if (!scanRanges.isPointLookup()) {
             appendKeyRanges(buf);
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4acd0cd/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
index c85b1d6..2133349 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfoBuilder.java
@@ -104,7 +104,7 @@ public class GuidePostsInfoBuilder {
     }
 
     public boolean addGuidePosts(byte[] row, long byteCount, long rowCount) {
-        return addGuidePosts(new ImmutableBytesWritable(row), byteCount, 0);
+        return addGuidePosts(new ImmutableBytesWritable(row), byteCount, rowCount);
     }
 
     private void close() {


Mime
View raw message