You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Naveen Gangam (JIRA)" <ji...@apache.org> on 2018/06/20 20:12:00 UTC

[jira] [Commented] (HIVE-19933) ALTER TABLE DROP PARTITION - Partition Not Found

    [ https://issues.apache.org/jira/browse/HIVE-19933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518549#comment-16518549 ] 

Naveen Gangam commented on HIVE-19933:
--------------------------------------

[~belugabehr] This appears to be an optimization for commands where there are multiple partition specs in the drop command. 
{code}
0: jdbc:hive2://localhost:10000> set hive.exec.drop.ignorenonexistent;
+----------------------------------------+
|                  set                   |
+----------------------------------------+
| hive.exec.drop.ignorenonexistent=true  |
+----------------------------------------+
0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs DROP PARTITION (`date`='xyz');
0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs DROP if exists PARTITION (`date`='xyz');
0: jdbc:hive2://localhost:10000> set hive.exec.drop.ignorenonexistent=false;
0: jdbc:hive2://localhost:10000> set hive.exec.drop.ignorenonexistent;
+-----------------------------------------+
|                   set                   |
+-----------------------------------------+
| hive.exec.drop.ignorenonexistent=false  |
+-----------------------------------------+
0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs DROP if exists PARTITION (`date`='xyz');
0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs DROP PARTITION (`date`='xyz');
Error: Error while compiling statement: FAILED: SemanticException [Error 10006]: Partition not found (date = 'xyz') (state=42000,code=10006)

0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs ADD PARTITION (`date`='date1', `date`='date2');
0: jdbc:hive2://localhost:10000> ALTER TABLE web_logs DROP PARTITION (`date`='xyz', `date`='date1', `date`='date2');
Error: Error while compiling statement: FAILED: SemanticException [Error 10006]: Partition not found (((date = 'xyz') and (date = 'date1')) and (date = 'date2')) (state=42000,code=10006)
0: jdbc:hive2://localhost:10000> show partitions web_logs;
+-------------+
|  partition  |
+-------------+
| date=date1  |
| date=date2  |
+-------------+
{code}

So when there are multiple partitions specs, not finding one of parts listed will prevent it from processing other partitions in the command. But the output error message is controlled by a hive config property.

The error message does not clearly point out what partition is missing. What should the behavior be when
1) if exists is specified and one or more partitions do not exist.
2) without "if exists" clause, when one or more partitions do not exist.

Thanks

> ALTER TABLE DROP PARTITION - Partition Not Found
> ------------------------------------------------
>
>                 Key: HIVE-19933
>                 URL: https://issues.apache.org/jira/browse/HIVE-19933
>             Project: Hive
>          Issue Type: Improvement
>          Components: HiveServer2
>    Affects Versions: 1.2.2
>            Reporter: BELUGA BEHR
>            Assignee: Naveen Gangam
>            Priority: Major
>
> {code:sql}
> ALTER TABLE web_logsz DROP PARTITION (`date`='xyz')
> -- SemanticException [Error 10001]: Table not found web_logsz
> ALTER TABLE web_logs DROP PARTITION (`date`='xyz')
> -- Success.
> {code}
> There is no 'xyz' partition for the 'date' column.  To make this more consistent, the query should fail if the user tries to drop a partition that does not exist



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)