-
Notifications
You must be signed in to change notification settings - Fork 900
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
Support all time_bucket variants in plan time chunk exclusion #6552
Conversation
@erimatnor, @gayyappan: please review this pull request.
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6552 +/- ##
==========================================
- Coverage 79.72% 79.68% -0.05%
==========================================
Files 188 188
Lines 36871 36809 -62
Branches 9327 9313 -14
==========================================
- Hits 29397 29330 -67
- Misses 3118 3129 +11
+ Partials 4356 4350 -6 ☔ View full report in Codecov by Sentry. |
Thanks for working on it. Can I close an old WIP PR that intend to do part of this job #4854? |
Yes this should be a superset of the features of your PR |
dfa376d
to
6a87bbf
Compare
Since the optional time_bucket arguments like offset, origin and timezone shift the output by at most bucket width we can optimize these similar to how we optimize the other time_bucket constraints. Fixes timescale#4825
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.
LGTM
@@ -493,10 +514,11 @@ ts_transform_time_bucket_comparison(Expr *node) | |||
|
|||
/* | |||
* When the time_bucket constraint matches the start of the bucket | |||
* and we have a less than constraint we can skip adding the | |||
* full bucket. | |||
* and we have a less than constraint and no offset we can skip |
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.
NIT:
* and we have a less than constraint and no offset we can skip | |
* and we have a less than constraint and no offset we can skip |
|
||
Const *width = linitial(time_bucket->args); | ||
Oid opno = op->opno; | ||
Assert(list_length(time_bucket->args) == 2 || list_length(time_bucket->args) == 3 || |
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.
I don't see where a 4 arg variant would bail out above?
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.
There is only 2,3 and 5 args versions
*/ | ||
if (strategy == BTLessStrategyNumber && integralValue % integralWidth == 0) | ||
if (strategy == BTLessStrategyNumber && list_length(time_bucket->args) == 2 && |
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.
should we try to handle the offset % period = 0 case here too? This is just an optimization? In that case probably not worth handling. But if there are correctness implications...
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.
This is just an optimization, with the additional args it gets a bit more complicated
Automated backport to 2.13.x not done: cherry-pick failed. Git status
|
Since the optional time_bucket arguments like offset, origin and timezone shift the output by at most bucket width we can optimize these similar to how we optimize the other time_bucket constraints.
Fixes #4825