Repository: incubator-drill
Updated Branches:
  refs/heads/master 81fb18a08 -> a13fc39b0


DRILL-1433: Fixing Where query on HBase store when row_key doesn't exist in 
HBase


Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/0f286403
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/0f286403
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/0f286403

Branch: refs/heads/master
Commit: 0f286403c4c239e572c4a34ff2a15e605c0d036b
Parents: 81fb18a
Author: Kamesh <[email protected]>
Authored: Tue Sep 30 11:49:35 2014 -0700
Committer: Steven Phillips <[email protected]>
Committed: Tue Sep 30 11:49:35 2014 -0700

----------------------------------------------------------------------
 .../drill/exec/store/hbase/TableStatsCalculator.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f286403/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/TableStatsCalculator.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/TableStatsCalculator.java
 
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/TableStatsCalculator.java
index 6a1f9f6..473deeb 100644
--- 
a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/TableStatsCalculator.java
+++ 
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/TableStatsCalculator.java
@@ -53,9 +53,9 @@ public class TableStatsCalculator {
    */
   private Map<byte[], Long> sizeMap = null;
 
-  private int avgRowSizeInBytes;
+  private int avgRowSizeInBytes = 1;
 
-  private int colsPerRow;
+  private int colsPerRow = 1;
 
   /**
    * Computes size of each region for table.
@@ -83,8 +83,10 @@ public class TableStatsCalculator {
           numColumnsSum += row.size();
           rowSizeSum += row.getBytes().getLength();
         }
-        avgRowSizeInBytes = rowSizeSum/rowCount;
-        colsPerRow = numColumnsSum/rowCount;
+        if (rowCount > 0) {
+          avgRowSizeInBytes = rowSizeSum/rowCount;
+          colsPerRow = numColumnsSum/rowCount;
+        }
         scanner.close();
       }
 

Reply via email to