-
Notifications
You must be signed in to change notification settings - Fork 888
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
Fix wrong origin returned by cagg_get_bucket_function_info #7533
base: main
Are you sure you want to change the base?
Fix wrong origin returned by cagg_get_bucket_function_info #7533
Conversation
443d35b
to
9270501
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7533 +/- ##
==========================================
+ Coverage 80.06% 81.24% +1.17%
==========================================
Files 190 230 +40
Lines 37181 43034 +5853
Branches 9450 10764 +1314
==========================================
+ Hits 29770 34964 +5194
- Misses 2997 3713 +716
+ Partials 4414 4357 -57 ☔ View full report in Codecov by Sentry. |
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.
Looks good in general, left a question about readability and setting the right expectations in the code.
* - time_bucket(width INTERVAL, ts TIMESTAMPTZ, timezone TEXT, origin TIMESTAMPTZ, | ||
* offset INTERVAL) | ||
*/ | ||
if (nargs >= 4) |
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.
Why not make it explicit that there can only be 3 or 5 arguments? I'd move this into a single check expecting exactly 5 arguments since 4 arguments should not happen.
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.
But FuncExpr arguments is not aligned with the actual function signature, for example this function call: time_bucket('1 hour', ts, timezone=>'America/Sao_Paulo', offset=>'1 day')
is actually the 5 arguments time bucket but FuncExpr has 4 arguments (FuncExpr->args). The logic to decide what to do with arguments is on process_additional_timebucket_parameter
.
In timescale#7042 we refactored the code for getting the time bucket function info to read information from the stored query tree on Postgres metadata. But when an origin was not specified it was returning a wrong value instead of NULL. Fixed it by properly dealing with non-defined origin and also simplified a bit the code to process time bucket parameters.
9270501
to
1b66597
Compare
In #7042 we refactored the code for getting the time bucket function info to read information from the stored query tree on Postgres metadata.
But when an origin was not specified it was returning a wrong value instead of NULL. Fixed it by properly dealing with non-defined origin and also simplified a bit the code to process time bucket parameters.
Disable-check: force-changelog-file