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 2015/04/29 18:26:42 UTC

phoenix git commit: Fix getRowCount()

Repository: phoenix
Updated Branches:
  refs/heads/calcite 977d78c16 -> ff4c733e3


Fix getRowCount()


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

Branch: refs/heads/calcite
Commit: ff4c733e39ee18531adcefc08873d5e63cf8ecc3
Parents: 977d78c
Author: maryannxue <we...@intel.com>
Authored: Wed Apr 29 12:22:57 2015 -0400
Committer: maryannxue <we...@intel.com>
Committed: Wed Apr 29 12:22:57 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/calcite/PhoenixTable.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff4c733e/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
index ea52edf..a8e16d1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
@@ -28,6 +28,7 @@ import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.stats.GuidePostsInfo;
 import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.util.SchemaUtil;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -95,10 +96,9 @@ public class PhoenixTable extends AbstractTable implements TranslatableTable {
         return new Statistic() {
             @Override
             public Double getRowCount() {
-                int rowCount = 0;
-                for (Map.Entry<byte[], GuidePostsInfo> entry : pTable.getTableStats().getGuidePosts().entrySet()) {
-                    rowCount += entry.getValue().getRowCount();
-                }
+                byte[] emptyCf = SchemaUtil.getEmptyColumnFamily(pTable);
+                GuidePostsInfo info = pTable.getTableStats().getGuidePosts().get(emptyCf);
+                long rowCount = info == null ? 0 : info.getRowCount();
                 
                 // Return an non-zero value to make the query plans stable.
                 // TODO remove "* 10.0" which is for test purpose.