hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khorg...@apache.org
Subject svn commit: r1593454 - in /hive/branches/branch-0.13/ql/src: java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java test/queries/clientpositive/drop_partitions_filter2.q test/results/clientpositive/drop_partitions_filter2.q.out
Date Thu, 08 May 2014 23:25:21 GMT
Author: khorgath
Date: Thu May  8 23:25:20 2014
New Revision: 1593454

URL: http://svn.apache.org/r1593454
Log:
Drop partitions treats partition columns as strings (Sergey Shelukhin, reviewed by Jitendra
Nath Pandey)

Modified:
    hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
    hive/branches/branch-0.13/ql/src/test/queries/clientpositive/drop_partitions_filter2.q
    hive/branches/branch-0.13/ql/src/test/results/clientpositive/drop_partitions_filter2.q.out

Modified: hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java?rev=1593454&r1=1593453&r2=1593454&view=diff
==============================================================================
--- hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
(original)
+++ hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
Thu May  8 23:25:20 2014
@@ -136,9 +136,13 @@ import org.apache.hadoop.hive.ql.plan.Un
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.serde.serdeConstants;
 import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.Converter;
 import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
 import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
 import org.apache.hadoop.mapred.InputFormat;
 import org.apache.hadoop.mapred.TextInputFormat;
@@ -2927,10 +2931,13 @@ public class DDLSemanticAnalyzer extends
           throw new SemanticException("Column " + key + " not found");
         }
         // Create the corresponding hive expression to filter on partition columns.
-        ExprNodeColumnDesc column = new ExprNodeColumnDesc(
-            TypeInfoFactory.getPrimitiveTypeInfo(type), key, null, true);
+        PrimitiveTypeInfo pti = TypeInfoFactory.getPrimitiveTypeInfo(type);
+        Converter converter = ObjectInspectorConverters.getConverter(
+          TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(TypeInfoFactory.stringTypeInfo),
+          TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(pti));
+        ExprNodeColumnDesc column = new ExprNodeColumnDesc(pti, key, null, true);
         ExprNodeGenericFuncDesc op = makeBinaryPredicate(
-            operator, column, new ExprNodeConstantDesc(val));
+            operator, column, new ExprNodeConstantDesc(pti, converter.convert(val)));
         // If it's multi-expr filter (e.g. a='5', b='2012-01-02'), AND with previous exprs.
         expr = (expr == null) ? op : makeBinaryPredicate("and", expr, op);
         names.add(key);

Modified: hive/branches/branch-0.13/ql/src/test/queries/clientpositive/drop_partitions_filter2.q
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/test/queries/clientpositive/drop_partitions_filter2.q?rev=1593454&r1=1593453&r2=1593454&view=diff
==============================================================================
--- hive/branches/branch-0.13/ql/src/test/queries/clientpositive/drop_partitions_filter2.q
(original)
+++ hive/branches/branch-0.13/ql/src/test/queries/clientpositive/drop_partitions_filter2.q
Thu May  8 23:25:20 2014
@@ -6,7 +6,7 @@ alter table ptestfilter add partition (c
 alter table ptestFilter add partition (c=2, d=1);
 alter table ptestfilter add partition (c=2, d=2);
 alter table ptestfilter add partition (c=3, d=1);
-alter table ptestfilter add partition (c=3, d=2);
+alter table ptestfilter add partition (c=30, d=2);
 show partitions ptestfilter;
 
 alter table ptestfilter drop partition (c=1, d=1);
@@ -15,6 +15,9 @@ show partitions ptestfilter;
 alter table ptestfilter drop partition (c=2);
 show partitions ptestfilter;
 
+alter table ptestfilter drop partition (c<4);
+show partitions ptestfilter;
+
 drop table ptestfilter;
 
 

Modified: hive/branches/branch-0.13/ql/src/test/results/clientpositive/drop_partitions_filter2.q.out
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/test/results/clientpositive/drop_partitions_filter2.q.out?rev=1593454&r1=1593453&r2=1593454&view=diff
==============================================================================
--- hive/branches/branch-0.13/ql/src/test/results/clientpositive/drop_partitions_filter2.q.out
(original)
+++ hive/branches/branch-0.13/ql/src/test/results/clientpositive/drop_partitions_filter2.q.out
Thu May  8 23:25:20 2014
@@ -56,13 +56,13 @@ POSTHOOK: query: alter table ptestfilter
 POSTHOOK: type: ALTERTABLE_ADDPARTS
 POSTHOOK: Output: default@ptestfilter
 POSTHOOK: Output: default@ptestfilter@c=3/d=1
-PREHOOK: query: alter table ptestfilter add partition (c=3, d=2)
+PREHOOK: query: alter table ptestfilter add partition (c=30, d=2)
 PREHOOK: type: ALTERTABLE_ADDPARTS
 PREHOOK: Output: default@ptestfilter
-POSTHOOK: query: alter table ptestfilter add partition (c=3, d=2)
+POSTHOOK: query: alter table ptestfilter add partition (c=30, d=2)
 POSTHOOK: type: ALTERTABLE_ADDPARTS
 POSTHOOK: Output: default@ptestfilter
-POSTHOOK: Output: default@ptestfilter@c=3/d=2
+POSTHOOK: Output: default@ptestfilter@c=30/d=2
 PREHOOK: query: show partitions ptestfilter
 PREHOOK: type: SHOWPARTITIONS
 PREHOOK: Input: default@ptestfilter
@@ -74,7 +74,7 @@ c=1/d=2
 c=2/d=1
 c=2/d=2
 c=3/d=1
-c=3/d=2
+c=30/d=2
 PREHOOK: query: alter table ptestfilter drop partition (c=1, d=1)
 PREHOOK: type: ALTERTABLE_DROPPARTS
 PREHOOK: Input: default@ptestfilter
@@ -93,7 +93,7 @@ c=1/d=2
 c=2/d=1
 c=2/d=2
 c=3/d=1
-c=3/d=2
+c=30/d=2
 PREHOOK: query: alter table ptestfilter drop partition (c=2)
 PREHOOK: type: ALTERTABLE_DROPPARTS
 PREHOOK: Input: default@ptestfilter
@@ -112,7 +112,24 @@ POSTHOOK: type: SHOWPARTITIONS
 POSTHOOK: Input: default@ptestfilter
 c=1/d=2
 c=3/d=1
-c=3/d=2
+c=30/d=2
+PREHOOK: query: alter table ptestfilter drop partition (c<4)
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=1/d=2
+PREHOOK: Output: default@ptestfilter@c=3/d=1
+POSTHOOK: query: alter table ptestfilter drop partition (c<4)
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=1/d=2
+POSTHOOK: Output: default@ptestfilter@c=3/d=1
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+POSTHOOK: Input: default@ptestfilter
+c=30/d=2
 PREHOOK: query: drop table ptestfilter
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@ptestfilter



Mime
View raw message