Skip to content

Make sure to handle COUNT and SUM with DISTINCT columns with empty input#5097

Merged
sougou merged 4 commits intovitessio:masterfrom
systay:aggregation-distinct-with-empty-input
Aug 17, 2019
Merged

Make sure to handle COUNT and SUM with DISTINCT columns with empty input#5097
sougou merged 4 commits intovitessio:masterfrom
systay:aggregation-distinct-with-empty-input

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Aug 14, 2019

No description provided.

Andres Taylor added 4 commits August 14, 2019 16:54
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>
Copy link
Copy Markdown
Contributor

@sougou sougou left a 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?

@sougou sougou merged commit a7983a3 into vitessio:master Aug 17, 2019
func createEmptyValueFor(opcode AggregateOpcode) (sqltypes.Value, error) {
switch opcode {
case AggregateCountDistinct:
return sqltypes.NULL, nil
Copy link
Copy Markdown
Collaborator

@mpawliszyn mpawliszyn Aug 21, 2019

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.

Copy link
Copy Markdown
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants