-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make sure to handle COUNT and SUM with DISTINCT columns with empty input #5097
Make sure to handle COUNT and SUM with DISTINCT columns with empty input #5097
Conversation
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Signed-off-by: Andres Taylor <antaylor@squareup.com>
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.
Love the assert.
This does look like it will address all corner cases of #5036. @mpawliszyn: can you verify?
func createEmptyValueFor(opcode AggregateOpcode) (sqltypes.Value, error) { | ||
switch opcode { | ||
case AggregateCountDistinct: | ||
return sqltypes.NULL, nil |
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.
Crap @systay I think these are reversed no? We want count to always return non null.
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.
Here is a PR to fix it:
#5121
Signed-off-by: Manan Gupta <manan@planetscale.com> Co-authored-by: Manan Gupta <manan@planetscale.com>
No description provided.