jinxing64 opened a new pull request, #5534:
URL: https://github.com/apache/hudi/pull/5534
## What is the purpose of the pull request
In current code, AlterHoodieTableDropPartitionCommand and
TruncateHoodieTableCommand require all partition fields should be specified
when droping / truncating partitions(s), otherwise complain with
AnalyisException (HoodieSqlCommonUtils#normalizePartitionSpec).
But native Spark/Hive SQL have no such limitations – – partition matching is
provided as a functionality helping user to manage partition(s) in an easy way.
Say dropping partitions with a single SQL "alter table test drop partition
(year='2020')", but rather to specify all the partitions from (year='2020',
month='01', day='01') to (year='2020', month='12', day='31')
This PR propose to refine the partition matching logic when drop / truncate
partition and remove the limitation mentioned above.
## Brief change log
- Refine HoodieSqlCommonUtils#normalizePartitionSpec -- Reuse Spark
utilities for column verifying;
- HoodieSqlCommonUtils#getMatchingPartitions provides as a utility for
partition matching;
- Corresponding change in AlterHoodieTableDropPartitionCommand and
TruncateHoodieTableCommand
## Verify this pull request
- Added tests in TestAlterTableDropPartition and TestTruncateTable
## Committer checklist
- [ ] Has a corresponding JIRA in PR title & commit
- [ ] Commit message is descriptive of the change
- [ ] CI is green
- [ ] Necessary doc changes done or have another open PR
- [ ] For large changes, please consider breaking it into sub-tasks under
an umbrella JIRA.
--
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]