Index: ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java (date 1418340758000) +++ ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java (revision ) @@ -72,7 +72,7 @@ } public DropTableDesc(String tableName, Map> partSpecs, - boolean expectView, boolean ignoreProtection) { + boolean expectView, boolean ignoreProtection, boolean ifPurge) { this.tableName = tableName; this.partSpecs = new ArrayList(partSpecs.size()); for (Map.Entry> partSpec : partSpecs.entrySet()) { @@ -83,6 +83,7 @@ } this.ignoreProtection = ignoreProtection; this.expectView = expectView; + this.ifPurge = ifPurge; } /** Index: ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java (date 1418340758000) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java (revision ) @@ -2633,6 +2633,7 @@ // popular case but that's kinda hacky. Let's not do it for now. boolean canGroupExprs = ifExists; + boolean mustPurge = (ast.getFirstChildWithType(HiveParser.KW_PURGE) != null); Table tab = getTable(qualified); Map> partSpecs = getFullPartitionSpecs(ast, tab, canGroupExprs); @@ -2647,7 +2648,7 @@ addTableDropPartsOutputs(tab, partSpecs.values(), !ifExists, ignoreProtection); DropTableDesc dropTblDesc = - new DropTableDesc(getDotName(qualified), partSpecs, expectView, ignoreProtection); + new DropTableDesc(getDotName(qualified), partSpecs, expectView, ignoreProtection, mustPurge); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), dropTblDesc), conf)); } Index: ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g (date 1418340758000) +++ ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g (revision ) @@ -1111,8 +1111,8 @@ alterStatementSuffixDropPartitions[boolean table] @init { pushMsg("drop partition statement", state); } @after { popMsg(state); } - : KW_DROP ifExists? dropPartitionSpec (COMMA dropPartitionSpec)* ignoreProtection? - -> { table }? ^(TOK_ALTERTABLE_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection?) + : KW_DROP ifExists? dropPartitionSpec (COMMA dropPartitionSpec)* ignoreProtection? KW_PURGE? + -> { table }? ^(TOK_ALTERTABLE_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection? KW_PURGE?) -> ^(TOK_ALTERVIEW_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection?) ;