You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/08/24 19:14:02 UTC
hive git commit: HIVE-10631 : create_table_core method has invalid
update for Fast Stats (Aaron Tokhy via Ashutosh Chauhan)
Repository: hive
Updated Branches:
refs/heads/master a16bbd487 -> 9d3d3d013
HIVE-10631 : create_table_core method has invalid update for Fast Stats (Aaron Tokhy via Ashutosh Chauhan)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9d3d3d01
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9d3d3d01
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9d3d3d01
Branch: refs/heads/master
Commit: 9d3d3d0134fed704684fdefa9faa6ed949615cc0
Parents: a16bbd4
Author: Aaron Tokhy <at...@gmail.com>
Authored: Thu Aug 13 10:45:00 2015 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Mon Aug 24 10:12:18 2015 -0700
----------------------------------------------------------------------
.../hadoop/hive/metastore/HiveAlterHandler.java | 2 +-
.../hadoop/hive/metastore/HiveMetaStore.java | 6 +-----
.../hadoop/hive/metastore/MetaStoreUtils.java | 17 ++++++++++-------
.../ql/metadata/SessionHiveMetaStoreClient.java | 2 +-
4 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/9d3d3d01/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
index 99d6680..ee20430 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
@@ -236,7 +236,7 @@ public class HiveAlterHandler implements AlterHandler {
Database db = msdb.getDatabase(newt.getDbName());
// Update table stats. For partitioned table, we update stats in
// alterPartition()
- MetaStoreUtils.updateUnpartitionedTableStatsFast(db, newt, wh, false, true);
+ MetaStoreUtils.updateTableStatsFast(db, newt, wh, false, true);
}
updateTableColumnStatsForAlterTable(msdb, oldt, newt);
// now finally call alter table
http://git-wip-us.apache.org/repos/asf/hive/blob/9d3d3d01/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 ae500bf..1840e76 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -1408,11 +1408,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVESTATSAUTOGATHER) &&
!MetaStoreUtils.isView(tbl)) {
- if (tbl.getPartitionKeysSize() == 0) { // Unpartitioned table
- MetaStoreUtils.updateUnpartitionedTableStatsFast(db, tbl, wh, madeDir);
- } else { // Partitioned table with no partitions.
- MetaStoreUtils.updateUnpartitionedTableStatsFast(db, tbl, wh, true);
- }
+ MetaStoreUtils.updateTableStatsFast(db, tbl, wh, madeDir);
}
// set create time
http://git-wip-us.apache.org/repos/asf/hive/blob/9d3d3d01/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
index 907cbbf..f88f4dd 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
@@ -169,19 +169,22 @@ public class MetaStoreUtils {
return true;
}
- public static boolean updateUnpartitionedTableStatsFast(Database db, Table tbl, Warehouse wh,
+ public static boolean updateTableStatsFast(Database db, Table tbl, Warehouse wh,
boolean madeDir) throws MetaException {
- return updateUnpartitionedTableStatsFast(db, tbl, wh, madeDir, false);
+ return updateTableStatsFast(db, tbl, wh, madeDir, false);
}
- public static boolean updateUnpartitionedTableStatsFast(Database db, Table tbl, Warehouse wh,
+ public static boolean updateTableStatsFast(Database db, Table tbl, Warehouse wh,
boolean madeDir, boolean forceRecompute) throws MetaException {
- return updateUnpartitionedTableStatsFast(tbl,
- wh.getFileStatusesForUnpartitionedTable(db, tbl), madeDir, forceRecompute);
+ FileStatus[] fileStatuses = {};
+ if (tbl.getPartitionKeysSize() == 0) { // Update stats only when unpartitioned
+ fileStatuses = wh.getFileStatusesForUnpartitionedTable(db, tbl);
+ }
+ return updateTableStatsFast(tbl, fileStatuses, madeDir, forceRecompute);
}
/**
- * Updates the numFiles and totalSize parameters for the passed unpartitioned Table by querying
+ * Updates the numFiles and totalSize parameters for the passed Table by querying
* the warehouse if the passed Table does not already have values for these parameters.
* @param tbl
* @param fileStatus
@@ -190,7 +193,7 @@ public class MetaStoreUtils {
* these parameters set
* @return true if the stats were updated, false otherwise
*/
- public static boolean updateUnpartitionedTableStatsFast(Table tbl,
+ public static boolean updateTableStatsFast(Table tbl,
FileStatus[] fileStatus, boolean newDir, boolean forceRecompute) throws MetaException {
Map<String,String> params = tbl.getParameters();
http://git-wip-us.apache.org/repos/asf/hive/blob/9d3d3d01/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
index d20f196..51ff262 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java
@@ -386,7 +386,7 @@ public class SessionHiveMetaStoreClient extends HiveMetaStoreClient implements I
}
org.apache.hadoop.hive.metastore.api.Table newtCopy = deepCopyAndLowerCaseTable(newt);
- MetaStoreUtils.updateUnpartitionedTableStatsFast(newtCopy,
+ MetaStoreUtils.updateTableStatsFast(newtCopy,
getWh().getFileStatusesForSD(newtCopy.getSd()), false, true);
Table newTable = new Table(newtCopy);
String newDbName = newTable.getDbName();