-
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
smith: add all argument columns to ORDER BY #87085
Conversation
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 1 of 1 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)
-- commits
line 16 at r1:
nit: this will close the issue - is it desirable? If not, maybe do s/fixes/addresses/
.
This commit ensures that sqlsmith adds all function argument columns to the `ORDER BY` clause when nondetermistic functions are disabled. This is necessary for functions like `string_agg`, for which there may be multiple possible values for each argument when the order is not specified. As a special case, `lead` and `lag` require all input columns to be added to the `ORDER BY` clause. This is because while they respect the specified order, they can still access any value in the partition. This means that we need to uniquely specify which rows fall on the boundaries of each peer group. We can ensure this is the case by ordering on a key, and we can trivially order on a key by ordering on all columns. Partially addresses cockroachdb#85318 Fixes cockroachdb#87023 Release justification: testing-only change Release note: None
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! 1 of 0 LGTMs obtained (waiting on @DrewKimball)
Previously, yuzefovich (Yahor Yuzefovich) wrote…
nit: this will close the issue - is it desirable? If not, maybe do
s/fixes/addresses/
.
Done.
TFTR! |
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.
Nice find!
Thanks! |
Build failed: |
bors r+ |
Build succeeded: |
@DrewKimball Do you think the |
Now that you mention it, I think it's better to think in terms of what window functions don't need to order on a key - |
This commit ensures that sqlsmith adds all function argument columns to
the
ORDER BY
clause when nondetermistic functions are disabled. This isnecessary for functions like
string_agg
, for which there may be multiplepossible values for each argument when the order is not specified.
As a special case,
lead
andlag
require all input columns to be addedto the
ORDER BY
clause. This is because while they respect the specifiedorder, they can still access any value in the partition. This means that we
need to uniquely specify which rows fall on the boundaries of each peer group.
We can ensure this is the case by ordering on a key, and we can trivially
order on a key by ordering on all columns.
Partially addresses #85318
Fixes #87023
Release justification: testing-only change
Release note: None