[ https://issues.apache.org/jira/browse/HIVE-2908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phabricator updated HIVE-2908: ------------------------------ Attachment: HIVE-2908.D2523.1.patch sambavim requested code review of "HIVE-2908 [jira] Hive: Extend ALTER TABLE DROP PARTITION syntax to use all comparators". Reviewers: JIRA https://issues.apache.org/jira/browse/HIVE-2908 This diff introduces drop partition with non-equality comparisons on the partition key. You can now issue commands of the form: alter table <tbl> drop partition (key<value) to drop all partitions which satisfy the predicate. Changes were introduced to hive.g to allow the new operators: <, >, <>, !=, <=, >= in alter table drop partition statements. The change is implemented by using the method getPartitionsByFilter on the Hive object. In order to cleanup the passing around of the partition spec information, I introduced a new class called PartitionSpec which encapsulates one complete partition spec (multiple key value comparisons). The drop statement thus has a list of the PartitionSpec objects. Unit tests have been added to test the new functionality. Some existing test results needed an update due to the change in the AST for the partition spec. All unit tests passed with this change. The test results of the escape1.q test need an update as well but arc diff complains since it concludes the file is binary. I will work with the committer to make sure that change is captured before commit. To drop a partition from a Hive table, this works: ALTER TABLE foo DROP PARTITION(ds = 'date') ...but it should also work to drop all partitions prior to date. ALTER TABLE foo DROP PARTITION(ds < 'date') This task is to implement ALTER TABLE DROP PARTITION for all of the comparators, < > <= >= <> = != instead of just for =. TEST PLAN EMPTY REVISION DETAIL https://reviews.facebook.net/D2523 AFFECTED FILES ql/src/test/results/clientpositive/drop_partitions_filter.q.out ql/src/test/results/clientpositive/drop_multi_partitions.q.out ql/src/test/results/clientnegative/drop_partition_filter_failure.q.out ql/src/test/queries/clientpositive/drop_partitions_filter.q ql/src/test/queries/clientnegative/drop_partition_filter_failure.q ql/src/java/org/apache/hadoop/hive/ql/plan/DropTableDesc.java ql/src/java/org/apache/hadoop/hive/ql/plan/PartitionSpec.java ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java MANAGE HERALD DIFFERENTIAL RULES https://reviews.facebook.net/herald/view/differential/ WHY DID I GET THIS EMAIL? https://reviews.facebook.net/herald/transcript/5685/ Tip: use the X-Herald-Rules header to filter Herald messages in your client. > Hive: Extend ALTER TABLE DROP PARTITION syntax to use all comparators > --------------------------------------------------------------------- > > Key: HIVE-2908 > URL: https://issues.apache.org/jira/browse/HIVE-2908 > Project: Hive > Issue Type: Improvement > Components: Query Processor > Reporter: Sambavi Muthukrishnan > Assignee: Sambavi Muthukrishnan > Priority: Minor > Attachments: HIVE-2908.D2523.1.patch > > Original Estimate: 96h > Remaining Estimate: 96h > > To drop a partition from a Hive table, this works: > ALTER TABLE foo DROP PARTITION(ds = 'date') > ...but it should also work to drop all partitions prior to date. > ALTER TABLE foo DROP PARTITION(ds < 'date') > This task is to implement ALTER TABLE DROP PARTITION for all of the > comparators, < > <= >= <> = != instead of just for =. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira