-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
builtins: add extract functionality for intervals #43293
Conversation
73b9767
to
17a344f
Compare
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.
However please change the release note to add an actual deprecation notice for extract_duration
, as well as a note to the same effect in that function's text description.
Thanks
Reviewed 4 of 4 files at r1.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @solongordon)
This adds the postgres-esque implementation of extract for intervals. Tested a variety of edge cases and compared against what postgres returns. Currently leaving the `extract_duration` function alone - we could thereoetically get rid of it after this PR. It does behave slightly differently as well. Release note (sql change): Added new ability to call extract on an interval, e.g. `extract(day from interval '254 days')`. This follows the postgres implementation. Furthermore, this deprecates `extract_duration`, which will be removed at a later date.
bors r=knz thanks for the review :) |
39308: sql/sem: fix interaction between framing and peers in window functions r=yuzefovich a=yuzefovich **rowexec: minor refactor of partitionPeerGrouper** This commit removes allPeers peerGroupChecker and refactors partitionPeerGrouper to support the case of omitted ORDER BY clause. Release note: None **sql/sem: fix interaction between framing and peers in window functions** Previously, whenever we had a result of a window function already computed for a peer of the row, we would return that result. However, the concept of window framing takes precedence over the concept of peers (i.e. if the window frame over which we computed the result for a peer is different from the window frame of the current row, we need to recompute the result). Now this is fixed by tracking the boundaries of the window frame over which peerRes is computed and recomputing the latter when needed. There was also a bug in IsDefaultFrame where we forgot to check whether the mode of framing is RANGE. This caused incorrect results in some cases when ROWS or GROUPS modes of framing were used. Fixes: #38901. Fixes: #42935. Release note (bug fix): CockroachDB previously was returning incorrect results for some aggregate functions when used as window functions with non-default window frame. Now this is fixed. Note that MIN, MAX, SUM, AVG as well as "pure" window functions (i.e. non-aggregates) were not affected. 43293: builtins: add extract functionality for intervals r=knz a=otan Resolves #43209 This adds the postgres-esque implementation of extract for intervals. Tested a variety of edge cases and compared against what postgres returns. Currently leaving the `extract_duration` function alone - we could thereoetically get rid of it after this PR. It does behave slightly differently as well. Release note (sql change): Added new ability to call extract on an interval, e.g. `extract(day from interval '254 days')`. This follows the postgres implementation. Furthermore, this deprecates `extract_duration`, which will be removed at a later date. 43834: colexec: speed up ordered sync r=yuzefovich a=yuzefovich **colexec: refactor ordered sync to use assign instead of append** Ordered synchronizer sets the output one row at a time. Previously, we were calling Append on the output vectors, but it is faster to use Sets in such scenario. Release note: None **colexec: speed up ordered sync** This commit speeds up the ordered synchronizer with two modifications: 1. instead of updating the allocator after we copy a single whole row, we will now update the allocator after we copy a full batch of rows 2. to reduce the number of interface conversions we will "strip" output vectors to get to the underlying slices and will use those directly when copying the data. Release note: None Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com> Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
Build succeeded |
Resolves #43209
This adds the postgres-esque implementation of extract for intervals.
Tested a variety of edge cases and compared against what postgres
returns.
Currently leaving the
extract_duration
function alone - we couldthereoetically get rid of it after this PR. It does behave slightly
differently as well.
Release note (sql change): Added new ability to call extract on an
interval, e.g.
extract(day from interval '254 days')
. This followsthe postgres implementation. Furthermore, this deprecates
extract_duration
, which will be removed at a later date.