feat(sql): allow list of timestamps of higher precision than required in alter table attach/detach/drop partition #3002
Merged
bluestreak01 merged 16 commits intomasterfrom Feb 27, 2023
Conversation
… of higher precision than required
puzpuzpuz
reviewed
Feb 20, 2023
puzpuzpuz
reviewed
Feb 22, 2023
puzpuzpuz
reviewed
Feb 27, 2023
puzpuzpuz
approved these changes
Feb 27, 2023
Contributor
puzpuzpuz
left a comment
There was a problem hiding this comment.
Thanks for implementing this feature!
Collaborator
[PR Coverage check]😍 pass : 78 / 80 (97.50%) file detail
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2879
The approach is to let the compiler only process the chars required to understand a partition dir name, while ignoring the rest, for each of the items in the comma separated list following the
LISTtoken.Example, for a table partitioned by month:
2023-03-29T23is a valid partition name now for month granularity because the compiler knows that the patter for partition by month isyyyy-MM, which means it can parse a date up to month, thus-29T23is ignored. Incidentally, this would work tooalter table x drop partition list '2023-03-a-banana' ;. We are trying to make life easier for users who might use a full timestamp (select max(ts) from table) to drop a partition (the last one in this example).WHERE is not supported, no value, and harder a problem to solve.The case of partition by
weekis complicated. We first try to parse the partition name candidate with formatYYYY-Www, and if it fails we assume the user sent a string that looks more like a date, or a timestamp, and we parse it with the day patternyyyy-MM-dd, then we translate it to the timestamp of the day the week starts at.