-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: add the 'every' aggregate function #46059
Conversation
Not sure if there is an easier way of just translating the |
As far as I understand, this function is exactly equivalent to
|
Sounds good -- editing the distsql infra seemed wrong. I'll still have to make a scalar for it though, right? |
No need for a scalar. We'll just create the |
Alright done. Two things though:
|
pkg/sql/rowexec/version_history.txt, line 109 at r1 (raw file):
Haven't |
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.
That's fine to keep it in the map.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball, @rohany, and @yuzefovich)
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.
Reviewed 6 of 6 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball and @rohany)
pkg/sql/rowexec/version_history.txt, line 109 at r1 (raw file):
Previously, andy-kimball (Andy Kimball) wrote…
Haven't
BIT_AND
andBIT_OR
been around for a while?
For a few months, yes.
I don't think bumping up the version here is strictly required, yet it is beneficial. I believe without the bump the following can occur in a mixed version cluster:
- the gateway node has the newest version that supports
BIT_AND
, so when the query with this function is issued against the gateway, it thinks everything is great, so it sends out the flow specifications containing this function to remote nodes - the remote nodes, however, are running an older version which doesn't have the support for
BIT_AND
, so they will return an error to the gateway because they don't recognize the constant that corresponds toBIT_AND
, and the whole query will fail.
The important point is that we do not change the order of aggregate functions (i.e. the respective constants remain unchanged), so there is no change of some "internal" error or a crash due to aggregates mismatch. (If my understanding is incorrect, please let me know :) )
pkg/sql/sem/builtins/aggregate_builtins.go, line 148 at r1 (raw file):
), "every": makeBuiltin(aggProps(),
nit: these functions are sorted lexicographically.
Fixes cockroachdb#45842. Release justification: low risk update to functionality Release note (sql change): This PR adds the `every` aggregate function.
Sorry, I misread the dates on the commit that added bit_and and bit_or.
Yeah, this is what I'm thinking as well. |
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 I believe we need an approval from a tech lead or from Andy K since we're in stability period.
Reviewed 2 of 2 files at r2.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @andy-kimball and @rohany)
cc @andy-kimball for approval |
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.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @andy-kimball and @rohany)
bors r+ |
Build failed (retrying...) |
Build succeeded |
Fixes #45842.
Release justification: low risk update to functionality
Release note (sql change): This PR adds the
every
aggregate function.