hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r882013 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ql/src/test/queries/clientnegative/addpart1.q ql/src/test/results/clientnegative/addpart1.q.out
Date Thu, 19 Nov 2009 00:15:36 GMT
Author: namit
Date: Thu Nov 19 00:15:36 2009
New Revision: 882013

URL: http://svn.apache.org/viewvc?rev=882013&view=rev
Log:
HIVE-940 restrict creation of partitions with empty keys (Prasad Chakka via namit)


Added:
    hadoop/hive/trunk/ql/src/test/queries/clientnegative/addpart1.q
    hadoop/hive/trunk/ql/src/test/results/clientnegative/addpart1.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=882013&r1=882012&r2=882013&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Thu Nov 19 00:15:36 2009
@@ -264,9 +264,11 @@
 
     HIVE-929. Use a new parameter to check whether to merge files or not
     (He Yongqiang via namit)
-    
+
     HIVE-980 mapjoin followed by union does not work (namit via He Yongqiang)
 
+    HIVE-940 restrict creation of partitions with empty keys (Prasad Chakka via namit)
+
 Release 0.4.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=882013&r1=882012&r2=882013&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Thu Nov 19
00:15:36 2009
@@ -576,6 +576,13 @@
 
     org.apache.hadoop.hive.metastore.api.Partition partition = null;
 
+    for (FieldSchema field : tbl.getPartCols()) {
+      String val = partSpec.get(field.getName());
+      if(val == null || val.length() == 0) {
+        throw new HiveException("add partition: Value for key " + field.getName() + " is
null or empty");
+      }
+    }
+
     try {
       Partition tmpPart = new Partition(tbl, partSpec, location);
       partition = getMSC().add_partition(tmpPart.getTPartition());
@@ -604,7 +611,7 @@
     for (FieldSchema field : tbl.getPartCols()) {
       String val = partSpec.get(field.getName());
       if(val == null || val.length() == 0) {
-        throw new HiveException("Value for key " + field.getName() + " is null or empty");
+        throw new HiveException("get partition: Value for key " + field.getName() + " is
null or empty");
       }
       pvals.add(val);
     }

Added: hadoop/hive/trunk/ql/src/test/queries/clientnegative/addpart1.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientnegative/addpart1.q?rev=882013&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientnegative/addpart1.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientnegative/addpart1.q Thu Nov 19 00:15:36 2009
@@ -0,0 +1,12 @@
+drop table addpart1;
+create table addpart1 (a int) partitioned by (b string, c string);
+
+alter table addpart1 add partition (b='f', c='s');
+
+show partitions addpart1;
+
+alter table addpart1 add partition (b='f', c='');
+
+show prtitions addpart1;
+
+drop table addpart1;
\ No newline at end of file

Added: hadoop/hive/trunk/ql/src/test/results/clientnegative/addpart1.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientnegative/addpart1.q.out?rev=882013&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientnegative/addpart1.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientnegative/addpart1.q.out Thu Nov 19 00:15:36
2009
@@ -0,0 +1,23 @@
+PREHOOK: query: drop table addpart1
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table addpart1
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table addpart1 (a int) partitioned by (b string, c string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table addpart1 (a int) partitioned by (b string, c string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@addpart1
+PREHOOK: query: alter table addpart1 add partition (b='f', c='s')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: query: alter table addpart1 add partition (b='f', c='s')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Output: default@addpart1@b=f/c=s
+PREHOOK: query: show partitions addpart1
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions addpart1
+POSTHOOK: type: SHOWPARTITIONS
+b=f/c=s
+PREHOOK: query: alter table addpart1 add partition (b='f', c='')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+FAILED: Error in metadata: add partition: Value for key c is null or empty
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask



Mime
View raw message