hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r755393 - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/optimizer/ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/test/queries/clientnegative/ ql/src/test/results/clientnegative/
Date Tue, 17 Mar 2009 21:01:17 GMT
Author: namit
Date: Tue Mar 17 21:01:17 2009
New Revision: 755393

URL: http://svn.apache.org/viewvc?rev=755393&view=rev
Log:
HIVE-347. Fix lot of partition scans in strict mode in case of error in 
partition specification error. (namit)


Added:
    hadoop/hive/trunk/ql/src/test/queries/clientnegative/strict_pruning_2.q
    hadoop/hive/trunk/ql/src/test/results/clientnegative/strict_pruning_2.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=755393&r1=755392&r2=755393&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Tue Mar 17 21:01:17 2009
@@ -40,6 +40,9 @@
     HIVE-124. Fix empty aggregations to return 1 row instead of
     nothing. (namit)
 
+    HIVE-347. Fix lot of partition scans in strict mode in case of error in 
+    partition specification error. (namit)
+
 Release 0.2.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java?rev=755393&r1=755392&r2=755393&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java
Tue Mar 17 21:01:17 2009
@@ -184,9 +184,20 @@
       try {
         // pass both confirmed and unknown partitions through the map-reduce framework
         PartitionPruner.PrunedPartitionList partsList = pruner.prune();
+
+        // If all partitions are unknown, throw an error. 
+        if ((opProcCtx.getParseCtx().getConf().getVar(HiveConf.ConfVars.HIVEPARTITIONPRUNER).equalsIgnoreCase("strict"))
&&
+            (partsList.getConfirmedPartns().size() == 0) &&
+            (partsList.getUnknownPartns().size() != 0))
+          throw new SemanticException(ErrorMsg.INCORRECT_PARTITION_PREDICATE.getMsg(" for
Alias " + alias_id));
+
         parts = partsList.getConfirmedPartns();
         parts.addAll(partsList.getUnknownPartns());
-      } catch (HiveException e) {
+        
+      } catch (SemanticException e) {
+        throw e;
+      }
+      catch (HiveException e) {
         // Has to use full name to make sure it does not conflict with org.apache.commons.lang.StringUtils
         LOG.error(org.apache.hadoop.util.StringUtils.stringifyException(e));
         throw new SemanticException(e.getMessage(), e);

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java?rev=755393&r1=755392&r2=755393&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java Tue Mar 17
21:01:17 2009
@@ -60,6 +60,7 @@
   SAMPLE_RESTRICTION("Cannot Sample on More Than Two Columns"),
   SAMPLE_COLUMN_NOT_FOUND("Sample Column Not Found"),
   NO_PARTITION_PREDICATE("No Partition Predicate Found"),
+  INCORRECT_PARTITION_PREDICATE("Incorrect Partition Predicate Found, probably wrong type,"),
   INVALID_DOT(". operator is only supported on struct or list of struct types"),
   INVALID_TBL_DDL_SERDE("Either list of columns or a custom serializer should be specified"),
   TARGET_TABLE_COLUMN_MISMATCH("Cannot insert into target table because column number/types
are different"),
@@ -120,4 +121,9 @@
   String getMsg() {
     return mesg;
   }
+
+  public String getMsg(String reason) {
+    return mesg + " " + reason;
+  }
+
 }

Added: hadoop/hive/trunk/ql/src/test/queries/clientnegative/strict_pruning_2.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientnegative/strict_pruning_2.q?rev=755393&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientnegative/strict_pruning_2.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientnegative/strict_pruning_2.q Tue Mar 17 21:01:17
2009
@@ -0,0 +1,6 @@
+set hive.partition.pruning=strict;
+
+EXPLAIN
+SELECT count(1) FROM srcPART x where x.ds = 2009-08-01;
+
+SELECT count(1) FROM srcPART where x.ds = 2009-08-01;

Added: hadoop/hive/trunk/ql/src/test/results/clientnegative/strict_pruning_2.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientnegative/strict_pruning_2.q.out?rev=755393&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientnegative/strict_pruning_2.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientnegative/strict_pruning_2.q.out Tue Mar 17
21:01:17 2009
@@ -0,0 +1 @@
+FAILED: Error in semantic analysis: Incorrect Partition Predicate Found, probably wrong type,
 for Alias x



Mime
View raw message