-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sql): allow list of timestamps of higher precision than required in alter table attach/detach/drop partition #3002
Merged
Conversation
This file contains 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
… of higher precision than required
marregui
added
New feature
Feature requests
SQL
Issues or changes relating to SQL execution
labels
Feb 18, 2023
puzpuzpuz
reviewed
Feb 20, 2023
marregui
changed the title
feat(sql): allow list of timestamps of higher precision than required int alter table attach/detach/drop partition
feat(sql): allow list of timestamps of higher precision than required in alter table attach/detach/drop partition
Feb 21, 2023
puzpuzpuz
reviewed
Feb 22, 2023
puzpuzpuz
reviewed
Feb 27, 2023
puzpuzpuz
approved these changes
Feb 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this feature!
[PR Coverage check]😍 pass : 78 / 80 (97.50%) file detail
|
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
LIST
token.Example, for a table partitioned by month:
2023-03-29T23
is 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-29T23
is 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
week
is 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.