hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1354162 - in /hive/branches/branch-0.9: ./ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/java/org/apache/hadoop/hive/ql/plan/ ql/src/test/queries/clientpositive/ ql/src/test/results/clientpositive/
Date Tue, 26 Jun 2012 18:48:35 GMT
Author: hashutosh
Date: Tue Jun 26 18:48:34 2012
New Revision: 1354162

URL: http://svn.apache.org/viewvc?rev=1354162&view=rev
Log:
HIVE-3076 : drop partition does not work for non-partition columns. Backported from trunk.

Added:
    hive/branches/branch-0.9/ql/src/test/queries/clientpositive/drop_partitions_filter3.q
      - copied unchanged from r1345274, hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter3.q
    hive/branches/branch-0.9/ql/src/test/results/clientpositive/drop_partitions_filter3.q.out
      - copied unchanged from r1345274, hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter3.q.out
Modified:
    hive/branches/branch-0.9/   (props changed)
    hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
    hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
    hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java

Propchange: hive/branches/branch-0.9/
------------------------------------------------------------------------------
  Merged /hive/trunk:r1345274

Modified: hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java?rev=1354162&r1=1354161&r2=1354162&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
(original)
+++ hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
Tue Jun 26 18:48:34 2012
@@ -52,6 +52,7 @@ import org.apache.hadoop.hive.ql.metadat
 import org.apache.hadoop.hive.ql.metadata.InvalidTableException;
 import org.apache.hadoop.hive.ql.metadata.Partition;
 import org.apache.hadoop.hive.ql.metadata.Table;
+import org.apache.hadoop.hive.ql.plan.PlanUtils;
 import org.apache.hadoop.hive.ql.session.SessionState.LogHelper;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe;
@@ -270,12 +271,8 @@ public abstract class BaseSemanticAnalyz
     rootTasks = new ArrayList<Task<? extends Serializable>>();
   }
 
-  public static String stripQuotes(String val) throws SemanticException {
-    if ((val.charAt(0) == '\'' && val.charAt(val.length() - 1) == '\'')
-        || (val.charAt(0) == '\"' && val.charAt(val.length() - 1) == '\"')) {
-      val = val.substring(1, val.length() - 1);
-    }
-    return val;
+  public static String stripQuotes(String val) {
+    return PlanUtils.stripQuotes(val);
   }
 
   public static String charSetString(String charSetName, String charSetString)

Modified: hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java?rev=1354162&r1=1354161&r2=1354162&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
(original)
+++ hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
Tue Jun 26 18:48:34 2012
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.hive.ql.plan;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -110,9 +109,9 @@ public class PartitionSpec {
   // For compatibility with other non-string partition columns, this function
   // returns the key, value mapping assuming that the operator is equality.
   public Map<String, String> getPartSpecWithoutOperator() {
-    Map<String, String> partSpec = new HashMap<String, String>();
+    Map<String, String> partSpec = new LinkedHashMap<String, String>();
     for (Map.Entry<String, PredicateSpec> entry: this.partSpec.entrySet()) {
-      partSpec.put(entry.getKey(), entry.getValue().getValue());
+      partSpec.put(entry.getKey(), PlanUtils.stripQuotes(entry.getValue().getValue()));
     }
 
     return partSpec;

Modified: hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java?rev=1354162&r1=1354161&r2=1354162&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java (original)
+++ hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java Tue
Jun 26 18:48:34 2012
@@ -724,6 +724,14 @@ public final class PlanUtils {
     }
   }
 
+  public static String stripQuotes(String val) {
+    if ((val.charAt(0) == '\'' && val.charAt(val.length() - 1) == '\'')
+        || (val.charAt(0) == '\"' && val.charAt(val.length() - 1) == '\"')) {
+      val = val.substring(1, val.length() - 1);
+    }
+    return val;
+  }
+
   private PlanUtils() {
     // prevent instantiation
   }



Mime
View raw message