You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by px...@apache.org on 2015/09/27 08:05:35 UTC

[1/2] hive git commit: HIVE-10965 : direct SQL for stats fails in 0-column case (Sergey Shelukhin reviewed by Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/branch-1.0 0bb08b3cd -> 37206a49f


HIVE-10965 : direct SQL for stats fails in 0-column case (Sergey Shelukhin reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/branch-1.0
Commit: 0b511cad47b61236da48e2b9768b3e6e8148b4e1
Parents: 0bb08b3
Author: Thejas Nair <th...@hortonworks.com>
Authored: Wed Jun 10 15:10:57 2015 -0700
Committer: Pengcheng Xiong <px...@apache.org>
Committed: Sat Sep 26 21:47:33 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java     | 1 +
 .../java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java | 2 ++
 ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java       | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/0b511cad/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 3c4d814..627f7ea 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -1900,6 +1900,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
   @Override
   public AggrStats getAggrColStatsFor(String dbName, String tblName,
     List<String> colNames, List<String> partNames) throws NoSuchObjectException, MetaException, TException {
+    if (colNames.isEmpty()) return null; // Nothing to aggregate.
     PartitionsStatsRequest req = new PartitionsStatsRequest(dbName, tblName, colNames, partNames);
     return client.get_aggr_stats_for(req);
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/0b511cad/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index a340e88..f34ce45 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -1082,6 +1082,7 @@ class MetaStoreDirectSql {
 
   public AggrStats aggrColStatsForPartitions(String dbName, String tableName,
       List<String> partNames, List<String> colNames) throws MetaException {
+    if (colNames.isEmpty() || partNames.isEmpty()) return new AggrStats(); // Nothing to aggregate.
     long partsFound = partsFoundForPartitions(dbName, tableName, partNames, colNames);
     List<ColumnStatisticsObj> stats = columnStatisticsObjForPartitions(dbName,
         tableName, partNames, colNames, partsFound);
@@ -1090,6 +1091,7 @@ class MetaStoreDirectSql {
 
   private long partsFoundForPartitions(String dbName, String tableName,
       List<String> partNames, List<String> colNames) throws MetaException {
+    assert !colNames.isEmpty() && !partNames.isEmpty();
     long partsFound = 0;
     boolean doTrace = LOG.isDebugEnabled();
     String queryText = "select count(\"COLUMN_NAME\") from \"PART_COL_STATS\""

http://git-wip-us.apache.org/repos/asf/hive/blob/0b511cad/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java
index 30f63a2..b0bd8ce 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java
@@ -245,7 +245,8 @@ public class StatsUtils {
         neededColumns = processNeededColumns(schema, neededColumns, colToTabAlias);
         AggrStats aggrStats = Hive.get().getAggrColStatsFor(table.getDbName(), table.getTableName(),
             neededColumns, partNames);
-        if (null == aggrStats) {
+        if (null == aggrStats || null == aggrStats.getColStats()
+            || aggrStats.getColStatsSize() == 0) {
           // There are some partitions with no state (or we didn't fetch any state).
           // Update the stats with empty list to reflect that in the
           // state/initialize structures.


[2/2] hive git commit: HIVE-9566: HiveServer2 fails to start with NullPointerException (Na via Xuefu)

Posted by px...@apache.org.
HIVE-9566: HiveServer2 fails to start with NullPointerException (Na via Xuefu)


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

Branch: refs/heads/branch-1.0
Commit: 37206a49f1f6e12f3ac997bb04d3b383ae7781e1
Parents: 0b511ca
Author: Xuefu Zhang <xz...@Cloudera.com>
Authored: Tue Jun 30 05:15:40 2015 -0700
Committer: Pengcheng Xiong <px...@apache.org>
Committed: Sat Sep 26 22:04:13 2015 -0700

----------------------------------------------------------------------
 service/src/java/org/apache/hive/service/server/HiveServer2.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/37206a49/service/src/java/org/apache/hive/service/server/HiveServer2.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 17e1d85..4f44987 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -267,7 +267,7 @@ public class HiveServer2 extends CompositeService {
     HiveConf hiveConf = this.getHiveConf();
     super.stop();
     // Remove this server instance from ZooKeeper if dynamic service discovery is set
-    if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY)) {
+    if (hiveConf != null && hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY)) {
       try {
         removeServerInstanceFromZooKeeper();
       } catch (Exception e) {
@@ -276,7 +276,7 @@ public class HiveServer2 extends CompositeService {
     }
     // There should already be an instance of the session pool manager.
     // If not, ignoring is fine while stopping HiveServer2.
-    if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_TEZ_INITIALIZE_DEFAULT_SESSIONS)) {
+    if (hiveConf != null && hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_TEZ_INITIALIZE_DEFAULT_SESSIONS)) {
       try {
         TezSessionPoolManager.getInstance().stop();
       } catch (Exception e) {