-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Issue #2779: DATE_PART structs #2822
Conversation
Implement for TIMESTAMP, DATE, TIME and INTERVAL. Tweak promotion weights to prefer VARCHAR to LIST.
Implement for TIMESTAMPTZ. Some minor code cleanup and templatisation. Expand test data.
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 the PR! Looks good. A request for more tests below. Also, since the purpose of this is to improve performance when multiple extractions are requested, could we add some benchmarks comparing multiple calls to date_part to a single call to date_part with multiple components? Particularly I'm interested in the cross-over point (is it already faster with two parts, or three parts, etc), since there does seem to be some extra work performed per value.
Handle hostile date part LISTs.
Filling in a |
I see parity at about 5 (['year', 'month', 'day', 'decade', 'week']), but they both seem to stop there. Profiling is indicated. It's also worth mentioning that ICU computes all parts when you ask for any of them, but the built in code only computes a few. Is it possible to benchmark ICU calls? |
You can add |
The crossover depends on what calculations are being performed. In particular, the week calculations are expensive and should only be performed if needed. After filtering computations for the struct, I see the crossover for the YMD family at around 4 values (year, month, day, decade are on par, but adding century puts struct ahead. The ICU part extraction always benefits because it always computes all parts. |
Perhaps it could be sped up by having a |
Filter out unneeded expensive date calls.
Benchmark ICU structs.
Reduce writes to improve performance.
Check for illegal parts and return 0 for time zone offsets.
Thanks for the updates! This looks great now. One minor nit: there are several combinations of date parts that appear to not be tested, e.g. the blocks with |
Improve coverage and fix a few small bugs.
Good call - found three small bugs! |
Excellent! Thanks for the updates. Everything looks now. |
Implement for TIMESTAMP, DATE, TIME, INTERVAL and TIMESTAMPTZ.
Tweak promotion weights to prefer VARCHAR to LIST.
Some minor code cleanup and templatisation.
Expand test data.