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 2014/07/09 18:56:54 UTC

svn commit: r1609244 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/exec/ java/org/apache/hadoop/hive/ql/parse/ test/queries/clientpositive/ test/results/clientpositive/

Author: hashutosh
Date: Wed Jul  9 16:56:54 2014
New Revision: 1609244

URL: http://svn.apache.org/r1609244
Log:
HIVE-7356 : Table level stats collection fail for partitioned tables (Ashutosh Chauhan via Gunther Hagleitner)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsTask.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
    hive/trunk/ql/src/test/queries/clientpositive/columnstats_partlvl.q
    hive/trunk/ql/src/test/results/clientpositive/columnstats_partlvl.q.out

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsTask.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsTask.java?rev=1609244&r1=1609243&r2=1609244&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsTask.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsTask.java Wed Jul  9 16:56:54 2014
@@ -287,7 +287,8 @@ public class ColumnStatsTask extends Tas
       Table tbl = db.getTable(dbName,tableName);
       List<FieldSchema> partColSchema = tbl.getPartCols();
       // Partition columns are appended at end, we only care about stats column
-      for (int i = 0; i < fields.size() - partColSchema.size(); i++) {
+      int numOfStatCols = isTblLevel ? fields.size() : fields.size() - partColSchema.size();
+      for (int i = 0; i < numOfStatCols; i++) {
         // Get the field objectInspector, fieldName and the field object.
         ObjectInspector foi = fields.get(i).getFieldObjectInspector();
         Object f = (list == null ? null : list.get(i));

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java?rev=1609244&r1=1609243&r2=1609244&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java Wed Jul  9 16:56:54 2014
@@ -300,8 +300,11 @@ public class ColumnStatsSemanticAnalyzer
       rewrittenQueryBuilder.append(numBitVectors);
       rewrittenQueryBuilder.append(" )");
     }
-    for (FieldSchema fs : tbl.getPartCols()) {
-      rewrittenQueryBuilder.append(" , " + fs.getName());
+
+    if (isPartitionStats) {
+      for (FieldSchema fs : tbl.getPartCols()) {
+        rewrittenQueryBuilder.append(" , " + fs.getName());
+      }
     }
     rewrittenQueryBuilder.append(" from ");
     rewrittenQueryBuilder.append(tbl.getTableName());

Modified: hive/trunk/ql/src/test/queries/clientpositive/columnstats_partlvl.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/columnstats_partlvl.q?rev=1609244&r1=1609243&r2=1609244&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/columnstats_partlvl.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/columnstats_partlvl.q Wed Jul  9 16:56:54 2014
@@ -25,3 +25,9 @@ analyze table Employee_Part partition (e
 
 describe formatted Employee_Part.employeeID   partition (employeeSalary=2000.0);
 describe formatted Employee_Part.employeeName partition (employeeSalary=2000.0);
+
+explain 
+analyze table Employee_Part  compute statistics for columns;
+analyze table Employee_Part  compute statistics for columns;
+
+describe formatted Employee_Part.employeeID;

Modified: hive/trunk/ql/src/test/results/clientpositive/columnstats_partlvl.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/columnstats_partlvl.q.out?rev=1609244&r1=1609243&r2=1609244&view=diff
==============================================================================
Files hive/trunk/ql/src/test/results/clientpositive/columnstats_partlvl.q.out (original) and hive/trunk/ql/src/test/results/clientpositive/columnstats_partlvl.q.out Wed Jul  9 16:56:54 2014 differ