Author: hashutosh
Date: Mon Mar 10 04:52:44 2014
New Revision: 1575823

URL: http://svn.apache.org/r1575823
Log:
HIVE-4723 : DDLSemanticAnalyzer.addTablePartsOutputs eats several exceptions 
(Szehon Ho via Ashutosh Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
    
hive/trunk/ql/src/test/results/clientnegative/alter_rename_partition_failure3.q.out
    hive/trunk/ql/src/test/results/clientnegative/touch2.q.out

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=1575823&r1=1575822&r2=1575823&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Mon Mar 
10 04:52:44 2014
@@ -85,6 +85,7 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.SerDeInfo;
 import org.apache.hadoop.hive.metastore.api.SkewedInfo;
 import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
+import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hadoop.hive.ql.exec.Utilities;
 import org.apache.hadoop.hive.ql.index.HiveIndexHandler;
 import 
org.apache.hadoop.hive.ql.optimizer.listbucketingpruner.ListBucketingPrunerUtils;
@@ -1791,8 +1792,7 @@ private void constructOneLBLocationMap(F
       short limit)
   throws HiveException {
     if (!tbl.isPartitioned()) {
-      throw new HiveException("Partition spec should only be supplied for a " +
-          "partitioned table");
+      throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, 
tbl.getTableName());
     }
 
     List<String> partialPvals = MetaStoreUtils.getPvals(tbl.getPartCols(), 
partialPartSpec);
@@ -1845,8 +1845,7 @@ private void constructOneLBLocationMap(F
       throws HiveException {
 
     if (!tbl.isPartitioned()) {
-      throw new HiveException("Partition spec should only be supplied for a " +
-                "partitioned table");
+      throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, 
tbl.getTableName());
     }
 
     List<String> names = getPartitionNames(tbl.getDbName(), tbl.getTableName(),
@@ -1870,8 +1869,7 @@ private void constructOneLBLocationMap(F
       throws HiveException {
 
     if (!tbl.isPartitioned()) {
-      throw new HiveException("Partition spec should only be supplied for a " +
-          "partitioned table");
+      throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, 
tbl.getTableName());
     }
     List<Partition> partitions = new ArrayList<Partition>(partNames.size());
 
@@ -1922,8 +1920,7 @@ private void constructOneLBLocationMap(F
       throws HiveException, MetaException, NoSuchObjectException, TException {
 
     if (!tbl.isPartitioned()) {
-      throw new HiveException("Partition spec should only be supplied for a " +
-          "partitioned table");
+      throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, 
tbl.getTableName());
     }
 
     List<org.apache.hadoop.hive.metastore.api.Partition> tParts = 
getMSC().listPartitionsByFilter(

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java?rev=1575823&r1=1575822&r2=1575823&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java 
(original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java 
Mon Mar 10 04:52:44 2014
@@ -138,6 +138,7 @@ import org.apache.hadoop.hive.serde2.typ
 import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
 import org.apache.hadoop.mapred.InputFormat;
 import org.apache.hadoop.mapred.TextInputFormat;
+import org.apache.hadoop.util.StringUtils;
 
 import com.google.common.collect.Lists;
 
@@ -2947,7 +2948,9 @@ public class DDLSemanticAnalyzer extends
         try {
           parts = db.getPartitions(tab, partSpec);
         } catch (HiveException e) {
-          LOG.error("Got HiveException during obtaining list of partitions");
+          LOG.error("Got HiveException during obtaining list of partitions"
+              + StringUtils.stringifyException(e));
+          throw new SemanticException(e.getMessage(), e);
         }
       } else {
         parts = new ArrayList<Partition>();
@@ -2957,7 +2960,8 @@ public class DDLSemanticAnalyzer extends
             parts.add(p);
           }
         } catch (HiveException e) {
-          LOG.debug("Wrong specification");
+          LOG.debug("Wrong specification" + StringUtils.stringifyException(e));
+          throw new SemanticException(e.getMessage(), e);
         }
       }
       if (parts.isEmpty()) {

Modified: 
hive/trunk/ql/src/test/results/clientnegative/alter_rename_partition_failure3.q.out
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/alter_rename_partition_failure3.q.out?rev=1575823&r1=1575822&r2=1575823&view=diff
==============================================================================
--- 
hive/trunk/ql/src/test/results/clientnegative/alter_rename_partition_failure3.q.out
 (original)
+++ 
hive/trunk/ql/src/test/results/clientnegative/alter_rename_partition_failure3.q.out
 Mon Mar 10 04:52:44 2014
@@ -29,8 +29,4 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alter_rename_partition_src
 POSTHOOK: Output: 
default@alter_rename_partition@pcol1=old_part1%3A/pcol2=old_part2%3A
 POSTHOOK: Lineage: alter_rename_partition 
PARTITION(pcol1=old_part1:,pcol2=old_part2:).col1 SIMPLE 
[(alter_rename_partition_src)alter_rename_partition_src.FieldSchema(name:col1, 
type:string, comment:null), ]
-PREHOOK: query: alter table alter_rename_partition partition 
(pCol1='old_part1:', pcol2='old_part2:') rename to partition 
(pCol1='old_part1:', pcol2='old_part2:', pcol3='old_part3:')
-PREHOOK: type: ALTERTABLE_RENAMEPART
-PREHOOK: Input: default@alter_rename_partition
-PREHOOK: Output: 
default@alter_rename_partition@pcol1=old_part1%3A/pcol2=old_part2%3A
-FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. Unable to rename partition.
+FAILED: SemanticException Partition spec {pcol1=old_part1:, pcol2=old_part2:, 
pcol3=old_part3:} contains non-partition columns

Modified: hive/trunk/ql/src/test/results/clientnegative/touch2.q.out
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/touch2.q.out?rev=1575823&r1=1575822&r2=1575823&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/touch2.q.out (original)
+++ hive/trunk/ql/src/test/results/clientnegative/touch2.q.out Mon Mar 10 
04:52:44 2014
@@ -1,4 +1 @@
-PREHOOK: query: ALTER TABLE src TOUCH PARTITION (ds='2008-04-08', hr='12')
-PREHOOK: type: ALTERTABLE_TOUCH
-PREHOOK: Input: default@src
-FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. table is not partitioned but partition 
spec exists: {ds=2008-04-08, hr=12}
+FAILED: SemanticException table is not partitioned but partition spec exists: 
{ds=2008-04-08, hr=12}


Reply via email to