FAQ
Author: kevinwilfong
Date: Mon Apr 2 16:38:13 2012
New Revision: 1308427

URL: http://svn.apache.org/viewvc?rev=1308427&view=rev
Log:
HIVE-2908. Hive: Extend ALTER TABLE DROP PARTITION syntax to use all comparators. (sambavim via kevinwilfong)

Added:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
hive/trunk/ql/src/test/queries/clientnegative/drop_partition_filter_failure.q
hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter.q
hive/trunk/ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out
hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter.q.out
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
hive/trunk/ql/src/test/results/clientnegative/drop_partition_failure.q.out
hive/trunk/ql/src/test/results/clientpositive/drop_multi_partitions.q.out
hive/trunk/ql/src/test/results/clientpositive/escape1.q.out

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java Mon Apr 2 16:38:13 2012
@@ -117,6 +117,7 @@ import org.apache.hadoop.hive.ql.plan.Gr
import org.apache.hadoop.hive.ql.plan.GrantRevokeRoleDDL;
import org.apache.hadoop.hive.ql.plan.LockTableDesc;
import org.apache.hadoop.hive.ql.plan.MsckDesc;
+import org.apache.hadoop.hive.ql.plan.PartitionSpec;
import org.apache.hadoop.hive.ql.plan.PrincipalDesc;
import org.apache.hadoop.hive.ql.plan.PrivilegeDesc;
import org.apache.hadoop.hive.ql.plan.PrivilegeObjectDesc;
@@ -3132,7 +3133,8 @@ public class DDLTask extends Task<DDLWor
* @throws HiveException
* Throws this exception if an unexpected error occurs.
*/
- private int dropTable(Hive db, DropTableDesc dropTbl) throws HiveException {
+ private int dropTable(Hive db, DropTableDesc dropTbl)
+ throws HiveException {
// We need to fetch the table before it is dropped so that it can be passed
// to
// post-execution hook
@@ -3195,13 +3197,18 @@ public class DDLTask extends Task<DDLWor
}

List<Partition> partsToDelete = new ArrayList<Partition>();
- for (Map<String, String> partSpec : dropTbl.getPartSpecs()) {
- List<Partition> partitions = db.getPartitions(tbl, partSpec);
+ for (PartitionSpec partSpec : dropTbl.getPartSpecs()) {
+ List<Partition> partitions = null;
+ try {
+ partitions = db.getPartitionsByFilter(tbl, partSpec.toString());
+ } catch (Exception e) {
+ throw new HiveException(e);
+ }
// this is to prevent dropping archived partition which is archived in a
// different level the drop command specified.
int partPrefixToDrop = 0;
for (FieldSchema fs : tbl.getPartCols()) {
- if (partSpec.get(fs.getName()) != null) {
+ if (partSpec.existsKey(fs.getName())) {
partPrefixToDrop += 1;
} else {
break;

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=1308427&r1=1308426&r2=1308427&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 Apr 2 16:38:13 2012
@@ -32,9 +32,9 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import java.util.Map.Entry;

import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.Tree;
@@ -58,8 +58,8 @@ import org.apache.hadoop.hive.ql.exec.Ut
import org.apache.hadoop.hive.ql.hooks.ReadEntity;
import org.apache.hadoop.hive.ql.hooks.WriteEntity;
import org.apache.hadoop.hive.ql.index.HiveIndex;
-import org.apache.hadoop.hive.ql.index.HiveIndexHandler;
import org.apache.hadoop.hive.ql.index.HiveIndex.IndexType;
+import org.apache.hadoop.hive.ql.index.HiveIndexHandler;
import org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat;
import org.apache.hadoop.hive.ql.io.RCFileInputFormat;
import org.apache.hadoop.hive.ql.metadata.Hive;
@@ -70,7 +70,9 @@ import org.apache.hadoop.hive.ql.metadat
import org.apache.hadoop.hive.ql.plan.AddPartitionDesc;
import org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc;
import org.apache.hadoop.hive.ql.plan.AlterIndexDesc;
+import org.apache.hadoop.hive.ql.plan.AlterIndexDesc.AlterIndexTypes;
import org.apache.hadoop.hive.ql.plan.AlterTableDesc;
+import org.apache.hadoop.hive.ql.plan.AlterTableDesc.AlterTableTypes;
import org.apache.hadoop.hive.ql.plan.AlterTableSimpleDesc;
import org.apache.hadoop.hive.ql.plan.CreateDatabaseDesc;
import org.apache.hadoop.hive.ql.plan.CreateIndexDesc;
@@ -88,6 +90,7 @@ import org.apache.hadoop.hive.ql.plan.Lo
import org.apache.hadoop.hive.ql.plan.LockTableDesc;
import org.apache.hadoop.hive.ql.plan.MoveWork;
import org.apache.hadoop.hive.ql.plan.MsckDesc;
+import org.apache.hadoop.hive.ql.plan.PartitionSpec;
import org.apache.hadoop.hive.ql.plan.PrincipalDesc;
import org.apache.hadoop.hive.ql.plan.PrivilegeDesc;
import org.apache.hadoop.hive.ql.plan.PrivilegeObjectDesc;
@@ -106,8 +109,6 @@ import org.apache.hadoop.hive.ql.plan.St
import org.apache.hadoop.hive.ql.plan.SwitchDatabaseDesc;
import org.apache.hadoop.hive.ql.plan.TableDesc;
import org.apache.hadoop.hive.ql.plan.UnlockTableDesc;
-import org.apache.hadoop.hive.ql.plan.AlterIndexDesc.AlterIndexTypes;
-import org.apache.hadoop.hive.ql.plan.AlterTableDesc.AlterTableTypes;
import org.apache.hadoop.hive.ql.security.authorization.Privilege;
import org.apache.hadoop.hive.ql.security.authorization.PrivilegeRegistry;
import org.apache.hadoop.hive.ql.session.SessionState;
@@ -1767,7 +1768,7 @@ public class DDLSemanticAnalyzer extends

String tblName = getUnescapedName((ASTNode)ast.getChild(0));
// get table metadata
- List<Map<String, String>> partSpecs = getPartitionSpecs(ast);
+ List<PartitionSpec> partSpecs = getFullPartitionSpecs(ast);
DropTableDesc dropTblDesc =
new DropTableDesc(tblName, partSpecs, expectView);

@@ -1786,7 +1787,7 @@ public class DDLSemanticAnalyzer extends
// configured not to fail silently
boolean throwException =
!ifExists && !HiveConf.getBoolVar(conf, ConfVars.DROPIGNORESNONEXISTENT);
- addTablePartsOutputs(tblName, partSpecs, throwException, false, ast);
+ addTableDropPartsOutputs(tblName, partSpecs, throwException);
}

rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
@@ -2071,6 +2072,39 @@ public class DDLSemanticAnalyzer extends
}

/**
+ * Get the partition specs from the tree. This stores the full specification
+ * with the comparator operator into the output list.
+ *
+ * @param ast
+ * Tree to extract partitions from.
+ * @return A list of PartitionSpec objects which contain the mapping from
+ * key to operator and value.
+ * @throws SemanticException
+ */
+ private List<PartitionSpec> getFullPartitionSpecs(CommonTree ast)
+ throws SemanticException {
+ List<PartitionSpec> partSpecList = new ArrayList<PartitionSpec>();
+
+ for (int childIndex = 1; childIndex < ast.getChildCount(); childIndex++) {
+ Tree partSpecTree = ast.getChild(childIndex);
+ if (partSpecTree.getType() == HiveParser.TOK_PARTSPEC) {
+ PartitionSpec partSpec = new PartitionSpec();
+
+ for (int i = 0; i < partSpecTree.getChildCount(); ++i) {
+ CommonTree partSpecSingleKey = (CommonTree) partSpecTree.getChild(i);
+ assert(partSpecSingleKey.getType() == HiveParser.TOK_PARTVAL);
+ String key = partSpecSingleKey.getChild(0).getText().toLowerCase();
+ String operator = partSpecSingleKey.getChild(1).getText();
+ String val = partSpecSingleKey.getChild(2).getText();
+ partSpec.addPredicate(key, operator, val);
+ }
+
+ partSpecList.add(partSpec);
+ }
+ }
+ return partSpecList;
+ }
+ /**
* Certain partition values are are used by hive. e.g. the default partition
* in dynamic partitioning and the intermediate partition values used in the
* archiving process. Naturally, prohibit the user from creating partitions
@@ -2129,7 +2163,7 @@ public class DDLSemanticAnalyzer extends
for (i = partSpecs.iterator(), index = 1; i.hasNext(); ++index) {
Map<String, String> partSpec = i.next();
List<Partition> parts = null;
- if(allowMany) {
+ if (allowMany) {
try {
parts = db.getPartitions(tab, partSpec);
} catch (HiveException e) {
@@ -2157,4 +2191,39 @@ public class DDLSemanticAnalyzer extends
}
}

+ /**
+ * Add the table partitions to be modified in the output, so that it is available for the
+ * pre-execution hook. If the partition does not exist, throw an error if
+ * throwIfNonExistent is true, otherwise ignore it.
+ */
+ private void addTableDropPartsOutputs(String tblName, List<PartitionSpec> partSpecs,
+ boolean throwIfNonExistent)
+ throws SemanticException {
+ Table tab;
+ try {
+ tab = db.getTable(tblName);
+ } catch (HiveException e) {
+ throw new SemanticException(ErrorMsg.INVALID_TABLE.getMsg(tblName));
+ }
+
+ Iterator<PartitionSpec> i;
+ int index;
+ for (i = partSpecs.iterator(), index = 1; i.hasNext(); ++index) {
+ PartitionSpec partSpec = i.next();
+ List<Partition> parts = null;
+ try {
+ parts = db.getPartitionsByFilter(tab, partSpec.toString());
+ } catch (Exception e) {
+ throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partSpec.toString()), e);
+ }
+ if (parts.isEmpty()) {
+ if(throwIfNonExistent) {
+ throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partSpec.toString()));
+ }
+ }
+ for(Partition p: parts) {
+ outputs.add(new WriteEntity(p));
+ }
+ }
+ }
}

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Mon Apr 2 16:38:13 2012
@@ -686,8 +686,8 @@ partitionLocation
alterStatementSuffixDropPartitions
@init { msgs.push("drop partition statement"); }
@after { msgs.pop(); }
- : Identifier KW_DROP ifExists? partitionSpec (COMMA partitionSpec)*
- -> ^(TOK_ALTERTABLE_DROPPARTS Identifier partitionSpec+ ifExists?)
+ : Identifier KW_DROP ifExists? dropPartitionSpec (COMMA dropPartitionSpec)*
+ -> ^(TOK_ALTERTABLE_DROPPARTS Identifier dropPartitionSpec+ ifExists?)
;

alterStatementSuffixProperties
@@ -2069,6 +2069,22 @@ partitionVal
Identifier (EQUAL constant)? -> ^(TOK_PARTVAL Identifier constant?)
;

+dropPartitionSpec
+ :
+ KW_PARTITION
+ LPAREN dropPartitionVal (COMMA dropPartitionVal )* RPAREN -> ^(TOK_PARTSPEC dropPartitionVal +)
+ ;
+
+dropPartitionVal
+ :
+ Identifier dropPartitionOperator constant -> ^(TOK_PARTVAL Identifier dropPartitionOperator constant)
+ ;
+
+dropPartitionOperator
+ :
+ EQUAL | NOTEQUAL | LESSTHANOREQUALTO | LESSTHAN | GREATERTHANOREQUALTO | GREATERTHAN
+ ;
+
sysFuncNames
:
KW_AND

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java Mon Apr 2 16:38:13 2012
@@ -20,9 +20,7 @@ package org.apache.hadoop.hive.ql.plan;

import java.io.Serializable;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;

/**
* DropTableDesc.
@@ -33,7 +31,7 @@ public class DropTableDesc extends DDLDe
private static final long serialVersionUID = 1L;

String tableName;
- ArrayList<LinkedHashMap<String, String>> partSpecs;
+ ArrayList<PartitionSpec> partSpecs;
boolean expectView;
boolean ifExists;

@@ -50,13 +48,12 @@ public class DropTableDesc extends DDLDe
this.ifExists = ifExists;
}

- public DropTableDesc(String tableName,
- List<? extends Map<String, String>> partSpecs, boolean expectView) {
-
+ public DropTableDesc(String tableName, List<PartitionSpec> partSpecs, boolean expectView) {
+
this.tableName = tableName;
- this.partSpecs = new ArrayList<LinkedHashMap<String, String>>(partSpecs.size());
+ this.partSpecs = new ArrayList<PartitionSpec>(partSpecs.size());
for (int i = 0; i < partSpecs.size(); i++) {
- this.partSpecs.add(new LinkedHashMap<String, String>(partSpecs.get(i)));
+ this.partSpecs.add(partSpecs.get(i));
}
this.expectView = expectView;
}
@@ -80,7 +77,7 @@ public class DropTableDesc extends DDLDe
/**
* @return the partSpecs
*/
- public ArrayList<LinkedHashMap<String, String>> getPartSpecs() {
+ public ArrayList<PartitionSpec> getPartSpecs() {
return partSpecs;
}

@@ -88,7 +85,7 @@ public class DropTableDesc extends DDLDe
* @param partSpecs
* the partSpecs to set
*/
- public void setPartSpecs(ArrayList<LinkedHashMap<String, String>> partSpecs) {
+ public void setPartSpecs(ArrayList<PartitionSpec> partSpecs) {
this.partSpecs = partSpecs;
}


Added: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java?rev=1308427&view=auto
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java (added)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java Mon Apr 2 16:38:13 2012
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.plan;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * PartitionSpec
+ *
+ */
+@Explain(displayName = "Partition specification")
+public class PartitionSpec {
+
+ private class PredicateSpec {
+ private String operator;
+ private String value;
+
+ public PredicateSpec() {
+ }
+
+ public PredicateSpec(String operator, String value) {
+ this.operator = operator;
+ this.value = value;
+ }
+
+ public String getOperator() {
+ return this.operator;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setOperator(String operator) {
+ this.operator = operator;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return (((this.operator.equals("!="))? "<>": this.operator) + " " + this.value);
+ }
+ }
+
+ private Map<String, PredicateSpec> partSpec;
+
+ public PartitionSpec() {
+ this.partSpec = new LinkedHashMap<String, PredicateSpec>();
+ }
+
+ /**
+ * @param key
+ * partition key name for one partition key compare in the spec
+ * @param operator
+ * the operator that is used for the comparison
+ * @param value
+ * the value to be compared against
+ */
+ public void addPredicate(String key, String operator, String value) {
+ partSpec.put(key, new PredicateSpec(operator, value));
+ }
+
+ /**
+ * @param key
+ * partition key to look for in the partition spec
+ * @return true if key exists in the partition spec, false otherwise
+ */
+ public boolean existsKey(String key) {
+ return (partSpec.get(key) != null);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder filterString = new StringBuilder();
+ int count = 0;
+ for (Map.Entry<String, PredicateSpec> entry: this.partSpec.entrySet()) {
+ if (count > 0) {
+ filterString.append(" AND ");
+ }
+ filterString.append(entry.getKey() + " " + entry.getValue().toString());
+ count++;
+ }
+ return filterString.toString();
+ }
+}

Added: hive/trunk/ql/src/test/queries/clientnegative/drop_partition_filter_failure.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/drop_partition_filter_failure.q?rev=1308427&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/drop_partition_filter_failure.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/drop_partition_filter_failure.q Mon Apr 2 16:38:13 2012
@@ -0,0 +1,8 @@
+create table ptestfilter1 (a string, b int) partitioned by (c string, d string);
+
+alter table ptestfilter1 add partition (c='US', d=1);
+show partitions ptestfilter1;
+
+set hive.exec.drop.ignorenonexistent=false;
+alter table ptestfilter1 drop partition (c='US', d<1);
+

Added: hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter.q?rev=1308427&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/drop_partitions_filter.q Mon Apr 2 16:38:13 2012
@@ -0,0 +1,37 @@
+create table ptestfilter (a string, b int) partitioned by (c string, d string);
+describe ptestfilter;
+
+alter table ptestfilter add partition (c='US', d=1);
+alter table ptestfilter add partition (c='US', d=2);
+alter table ptestFilter add partition (c='Uganda', d=2);
+alter table ptestfilter add partition (c='Germany', d=2);
+alter table ptestfilter add partition (c='Canada', d=3);
+alter table ptestfilter add partition (c='Russia', d=3);
+alter table ptestfilter add partition (c='Greece', d=2);
+alter table ptestfilter add partition (c='India', d=3);
+alter table ptestfilter add partition (c='France', d=4);
+show partitions ptestfilter;
+
+alter table ptestfilter drop partition (c='US', d<'2');
+show partitions ptestfilter;
+
+alter table ptestfilter drop partition (c>='US', d<='2');
+show partitions ptestfilter;
+
+alter table ptestfilter drop partition (c >'India');
+show partitions ptestfilter;
+
+alter table ptestfilter drop partition (c >='India'),
+ partition (c='Greece', d='2');
+show partitions ptestfilter;
+
+alter table ptestfilter drop partition (c != 'France');
+show partitions ptestfilter;
+
+set hive.exec.drop.ignorenonexistent=false;
+alter table ptestfilter drop if exists partition (c='US');
+show partitions ptestfilter;
+
+drop table ptestfilter;
+
+

Modified: hive/trunk/ql/src/test/results/clientnegative/drop_partition_failure.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/drop_partition_failure.q.out?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/drop_partition_failure.q.out (original)
+++ hive/trunk/ql/src/test/results/clientnegative/drop_partition_failure.q.out Mon Apr 2 16:38:13 2012
@@ -31,4 +31,4 @@ POSTHOOK: type: SHOWPARTITIONS
b=1/c=1
b=1/c=2
b=2/c=2
-FAILED: Error in semantic analysis: Line 3:31 Partition not found ''3''
+FAILED: Error in semantic analysis: Partition not found b = '3'

Added: hive/trunk/ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out?rev=1308427&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out Mon Apr 2 16:38:13 2012
@@ -0,0 +1,18 @@
+PREHOOK: query: create table ptestfilter1 (a string, b int) partitioned by (c string, d string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table ptestfilter1 (a string, b int) partitioned by (c string, d string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@ptestfilter1
+PREHOOK: query: alter table ptestfilter1 add partition (c='US', d=1)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter1
+POSTHOOK: query: alter table ptestfilter1 add partition (c='US', d=1)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter1
+POSTHOOK: Output: default@ptestfilter1@c=US/d=1
+PREHOOK: query: show partitions ptestfilter1
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter1
+POSTHOOK: type: SHOWPARTITIONS
+c=US/d=1
+FAILED: Error in semantic analysis: Partition not found c = 'US' AND d < 1

Modified: hive/trunk/ql/src/test/results/clientpositive/drop_multi_partitions.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/drop_multi_partitions.q.out?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/drop_multi_partitions.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/drop_multi_partitions.q.out Mon Apr 2 16:38:13 2012
@@ -36,7 +36,7 @@ PREHOOK: type: ALTERTABLE_DROPPARTS
POSTHOOK: query: explain extended alter table mp drop partition (b='1')
POSTHOOK: type: ALTERTABLE_DROPPARTS
ABSTRACT SYNTAX TREE:
- (TOK_ALTERTABLE_DROPPARTS mp (TOK_PARTSPEC (TOK_PARTVAL b '1')))
+ (TOK_ALTERTABLE_DROPPARTS mp (TOK_PARTSPEC (TOK_PARTVAL b = '1')))

STAGE DEPENDENCIES:
Stage-0 is a root stage
@@ -51,6 +51,8 @@ STAGE PLANS:
PREHOOK: query: alter table mp drop partition (b='1')
PREHOOK: type: ALTERTABLE_DROPPARTS
PREHOOK: Input: default@mp
+PREHOOK: Output: default@mp@b=1/c=1
+PREHOOK: Output: default@mp@b=1/c=2
POSTHOOK: query: alter table mp drop partition (b='1')
POSTHOOK: type: ALTERTABLE_DROPPARTS
POSTHOOK: Input: default@mp

Added: hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter.q.out?rev=1308427&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/drop_partitions_filter.q.out Mon Apr 2 16:38:13 2012
@@ -0,0 +1,199 @@
+PREHOOK: query: create table ptestfilter (a string, b int) partitioned by (c string, d string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table ptestfilter (a string, b int) partitioned by (c string, d string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@ptestfilter
+PREHOOK: query: describe ptestfilter
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: describe ptestfilter
+POSTHOOK: type: DESCTABLE
+a string
+b int
+c string
+d string
+PREHOOK: query: alter table ptestfilter add partition (c='US', d=1)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='US', d=1)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=US/d=1
+PREHOOK: query: alter table ptestfilter add partition (c='US', d=2)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='US', d=2)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=US/d=2
+PREHOOK: query: alter table ptestFilter add partition (c='Uganda', d=2)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestFilter add partition (c='Uganda', d=2)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Uganda/d=2
+PREHOOK: query: alter table ptestfilter add partition (c='Germany', d=2)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='Germany', d=2)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Germany/d=2
+PREHOOK: query: alter table ptestfilter add partition (c='Canada', d=3)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='Canada', d=3)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Canada/d=3
+PREHOOK: query: alter table ptestfilter add partition (c='Russia', d=3)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='Russia', d=3)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Russia/d=3
+PREHOOK: query: alter table ptestfilter add partition (c='Greece', d=2)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='Greece', d=2)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Greece/d=2
+PREHOOK: query: alter table ptestfilter add partition (c='India', d=3)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='India', d=3)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=India/d=3
+PREHOOK: query: alter table ptestfilter add partition (c='France', d=4)
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter add partition (c='France', d=4)
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=France/d=4
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=Canada/d=3
+c=France/d=4
+c=Germany/d=2
+c=Greece/d=2
+c=India/d=3
+c=Russia/d=3
+c=US/d=1
+c=US/d=2
+c=Uganda/d=2
+PREHOOK: query: alter table ptestfilter drop partition (c='US', d<'2')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=US/d=1
+POSTHOOK: query: alter table ptestfilter drop partition (c='US', d<'2')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=US/d=1
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=Canada/d=3
+c=France/d=4
+c=Germany/d=2
+c=Greece/d=2
+c=India/d=3
+c=Russia/d=3
+c=US/d=2
+c=Uganda/d=2
+PREHOOK: query: alter table ptestfilter drop partition (c>='US', d<='2')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=US/d=2
+PREHOOK: Output: default@ptestfilter@c=Uganda/d=2
+POSTHOOK: query: alter table ptestfilter drop partition (c>='US', d<='2')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=US/d=2
+POSTHOOK: Output: default@ptestfilter@c=Uganda/d=2
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=Canada/d=3
+c=France/d=4
+c=Germany/d=2
+c=Greece/d=2
+c=India/d=3
+c=Russia/d=3
+PREHOOK: query: alter table ptestfilter drop partition (c >'India')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=Russia/d=3
+POSTHOOK: query: alter table ptestfilter drop partition (c >'India')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Russia/d=3
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=Canada/d=3
+c=France/d=4
+c=Germany/d=2
+c=Greece/d=2
+c=India/d=3
+PREHOOK: query: alter table ptestfilter drop partition (c >='India'),
+ partition (c='Greece', d='2')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=Greece/d=2
+PREHOOK: Output: default@ptestfilter@c=India/d=3
+POSTHOOK: query: alter table ptestfilter drop partition (c >='India'),
+ partition (c='Greece', d='2')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Greece/d=2
+POSTHOOK: Output: default@ptestfilter@c=India/d=3
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=Canada/d=3
+c=France/d=4
+c=Germany/d=2
+PREHOOK: query: alter table ptestfilter drop partition (c != 'France')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter@c=Canada/d=3
+PREHOOK: Output: default@ptestfilter@c=Germany/d=2
+POSTHOOK: query: alter table ptestfilter drop partition (c != 'France')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter@c=Canada/d=3
+POSTHOOK: Output: default@ptestfilter@c=Germany/d=2
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=France/d=4
+PREHOOK: query: alter table ptestfilter drop if exists partition (c='US')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@ptestfilter
+POSTHOOK: query: alter table ptestfilter drop if exists partition (c='US')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@ptestfilter
+PREHOOK: query: show partitions ptestfilter
+PREHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: show partitions ptestfilter
+POSTHOOK: type: SHOWPARTITIONS
+c=France/d=4
+PREHOOK: query: drop table ptestfilter
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@ptestfilter
+PREHOOK: Output: default@ptestfilter
+POSTHOOK: query: drop table ptestfilter
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@ptestfilter
+POSTHOOK: Output: default@ptestfilter

Modified: hive/trunk/ql/src/test/results/clientpositive/escape1.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/escape1.q.out?rev=1308427&r1=1308426&r2=1308427&view=diff
==============================================================================
Files hive/trunk/ql/src/test/results/clientpositive/escape1.q.out (original) and hive/trunk/ql/src/test/results/clientpositive/escape1.q.out Mon Apr 2 16:38:13 2012 differ

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 2, '12 at 4:38p
activeApr 2, '12 at 4:38p
posts1
users1
websitehive.apache.org

1 user in discussion

Kevinwilfong: 1 post

People

Translate

site design / logo © 2021 Grokbase