Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C76A918E32 for ; Mon, 22 Feb 2016 06:33:43 +0000 (UTC) Received: (qmail 88391 invoked by uid 500); 22 Feb 2016 06:33:43 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 88311 invoked by uid 500); 22 Feb 2016 06:33:43 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 88300 invoked by uid 99); 22 Feb 2016 06:33:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2016 06:33:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5FAA9E0092; Mon, 22 Feb 2016 06:33:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: larsh@apache.org To: commits@phoenix.apache.org Date: Mon, 22 Feb 2016 06:33:43 -0000 Message-Id: <402c7a0027e84ab19c625c3f577c5737@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] phoenix git commit: PHOENIX-2702 Show estimate rows and bytes touched in explain plan. 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 Authored: Sun Feb 21 22:32:09 2016 -0800 Committer: Lars Hofhansl 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>>>> allFutures; + private long estimatedRows; + private long estimatedSize; static final Function TO_KEY_RANGE = new Function() { @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() {