marton-bod commented on a change in pull request #2448:
URL: https://github.com/apache/hive/pull/2448#discussion_r666052861



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/drop/AbstractDropPartitionAnalyzer.java
##########
@@ -90,13 +90,14 @@ protected void analyzeCommand(TableName tableName, 
Map<String, String> partition
         throw se;
       }
     }
+    validateAlterTableType(table, AlterTableType.DROPPARTITION, expectView());

Review comment:
       Ah, yes, thanks for asking, I wanted to provide an explanatory comment. 
So I think the current code flow is not perfect, because `ALTER TABLE tbl DROP 
PARTITION` commands should be disabled completely for non-native tables (that's 
what the `validateAlterTableType` checks). 
   
   However, right now the logic which parses and validates the partition clause 
part of the syntax tree (`ParseUtils.getFullPartitionSpecs`) runs first, 
therefore if you specify a partition which does not exist, e.g. `ALTER TABLE 
tbl DROP PARTITION('department'='does-not-exist')` on an Iceberg or HBase or 
whatever table, then you'll get an exception saying the `partition does not 
exist` instead of what I think we'd expect, which is `ALTER TABLE DROP 
PARTITION is not allowed for non-native tables`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to