You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/04/08 17:41:01 UTC
[02/14] phoenix git commit: PHOENIX-2714 Correct byte estimate in
BaseResultIterators and expose as interface
PHOENIX-2714 Correct byte estimate in BaseResultIterators and expose as interface
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5d6865ee
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5d6865ee
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5d6865ee
Branch: refs/heads/calcite
Commit: 5d6865eea00777314ae1ceab6941e781225b5428
Parents: 9e767ff
Author: maryannxue <ma...@gmail.com>
Authored: Fri Apr 1 11:56:43 2016 -0400
Committer: maryannxue <ma...@gmail.com>
Committed: Fri Apr 1 11:56:43 2016 -0400
----------------------------------------------------------------------
.../org/apache/phoenix/end2end/StatsCollectorIT.java | 6 ++++++
.../org/apache/phoenix/iterate/BaseResultIterators.java | 11 ++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d6865ee/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
index 2284ee2..f0fe346 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
@@ -133,6 +133,12 @@ public class StatsCollectorIT extends StatsCollectorAbstractIT {
"CLIENT 4-CHUNK 1 ROWS 34 BYTES PARALLEL 3-WAY FULL SCAN OVER " + fullTableName + "\n" +
"CLIENT MERGE SORT",
explainPlan);
+ rs = conn.createStatement().executeQuery("EXPLAIN SELECT * FROM " + fullTableName + " WHERE k = 'a'");
+ explainPlan = QueryUtil.getExplainPlan(rs);
+ assertEquals(
+ "CLIENT 1-CHUNK 1 ROWS 202 BYTES PARALLEL 1-WAY POINT LOOKUP ON 1 KEY OVER " + fullTableName + "\n" +
+ "CLIENT MERGE SORT",
+ explainPlan);
conn.close();
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d6865ee/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 c36a72b..8d4b34b 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
@@ -566,8 +566,10 @@ 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);
+ if (newScan != null) {
+ 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);
@@ -590,6 +592,9 @@ public abstract class BaseResultIterators extends ExplainTable implements Result
if (hasGuidePosts) {
this.estimatedRows = estimatedRows;
this.estimatedSize = estimatedSize;
+ } else if (scanRanges.isPointLookup()) {
+ this.estimatedRows = 1L;
+ this.estimatedSize = SchemaUtil.estimateRowSize(table);
} else {
this.estimatedRows = null;
this.estimatedSize = null;
@@ -876,7 +881,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result
QueryServices.EXPLAIN_ROW_COUNT_ATTRIB,
QueryServicesOptions.DEFAULT_EXPLAIN_ROW_COUNT);
buf.append(this.splits.size()).append("-CHUNK ");
- if (displayRowCount && hasGuidePosts) {
+ if (displayRowCount && estimatedRows != null) {
buf.append(estimatedRows).append(" ROWS ");
buf.append(estimatedSize).append(" BYTES ");
}