hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject [43/50] [abbrv] hive git commit: HIVE-11636 NPE in stats conversion with HBase metastore (Sergey Shelukhin via gates)
Date Tue, 22 Sep 2015 05:04:14 GMT
HIVE-11636 NPE in stats conversion with HBase metastore (Sergey Shelukhin via gates)


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

Branch: refs/heads/master
Commit: fbbb7cf1fa5691037243a6db3993f294ffb00eeb
Parents: e150af9
Author: Alan Gates <gates@hortonworks.com>
Authored: Fri Aug 28 11:03:26 2015 -0700
Committer: Alan Gates <gates@hortonworks.com>
Committed: Fri Aug 28 11:03:26 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/metastore/HiveMetaStore.java | 4 ++--
 .../org/apache/hadoop/hive/metastore/hbase/HBaseStore.java   | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fbbb7cf1/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index a06efc6..df64124 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -4281,8 +4281,8 @@ public class HiveMetaStore extends ThriftHiveMetastore {
       }
       try {
         ColumnStatistics cs = getMS().getTableColumnStatistics(dbName, tblName, lowerCaseColNames);
-        result = new TableStatsResult(
-            cs == null ? Lists.<ColumnStatisticsObj>newArrayList() : cs.getStatsObj());
+        result = new TableStatsResult((cs == null || cs.getStatsObj() == null)
+            ? Lists.<ColumnStatisticsObj>newArrayList() : cs.getStatsObj());
       } finally {
         endFunction("get_table_statistics_req: ", result == null, null, tblName);
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/fbbb7cf1/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
index 4cda9cc..df0fac3 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hive.metastore.RawStore;
 import org.apache.hadoop.hive.metastore.Warehouse;
 import org.apache.hadoop.hive.metastore.api.AggrStats;
 import org.apache.hadoop.hive.metastore.api.ColumnStatistics;
+import org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj;
 import org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
@@ -1693,9 +1694,11 @@ public class HBaseStore implements RawStore {
       partVals.add(partNameToVals(partName));
     }
     boolean commit = false;
+    boolean hasAnyStats = false;
     openTransaction();
     try {
       AggrStats aggrStats = new AggrStats();
+      aggrStats.setPartsFound(0);
       for (String colName : colNames) {
         try {
           AggrStats oneCol =
@@ -1704,6 +1707,7 @@ public class HBaseStore implements RawStore {
             assert oneCol.getColStatsSize() == 1;
             aggrStats.setPartsFound(oneCol.getPartsFound());
             aggrStats.addToColStats(oneCol.getColStats().get(0));
+            hasAnyStats = true;
           }
         } catch (CacheLoader.InvalidCacheLoadException e) {
           LOG.debug("Found no stats for column " + colName);
@@ -1712,6 +1716,10 @@ public class HBaseStore implements RawStore {
         }
       }
       commit = true;
+      if (!hasAnyStats) {
+        // Set the required field.
+        aggrStats.setColStats(new ArrayList<ColumnStatisticsObj>());
+      }
       return aggrStats;
     } catch (IOException e) {
       LOG.error("Unable to fetch aggregate column statistics", e);


Mime
View raw message