Skip to content

fix: incorrect result on Comet multiple column distinct count#268

Merged
viirya merged 2 commits intoapache:mainfrom
viirya:fix_distinct_count
Apr 15, 2024
Merged

fix: incorrect result on Comet multiple column distinct count#268
viirya merged 2 commits intoapache:mainfrom
viirya:fix_distinct_count

Conversation

@viirya
Copy link
Copy Markdown
Member

@viirya viirya commented Apr 15, 2024

Which issue does this PR close?

Closes #267.

Rationale for this change

What changes are included in this PR?

How are these changes tested?

Comment on lines +1097 to +1105
let mut children = vec![];
for child in expr.children.iter() {
children.push(self.create_expr(child, schema.clone())?);
}
Ok(Arc::new(Count::new_with_multiple_exprs(
children,
"count",
DataType::Int64,
)))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Count could take multiple children, but we used one child only.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 15, 2024

cc @huaxingao @sunchao

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 15, 2024

cc @andygrove

Copy link
Copy Markdown
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix.

Comment thread core/src/execution/datafusion/planner.rs Outdated
Co-authored-by: Andy Grove <andygrove73@gmail.com>
@viirya viirya merged commit c1a2746 into apache:main Apr 15, 2024
@viirya
Copy link
Copy Markdown
Member Author

viirya commented Apr 15, 2024

Merged. Thanks.

@viirya viirya deleted the fix_distinct_count branch April 15, 2024 22:46
himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
…#268)

* fix: incorrect result on Comet multiple column distinct count

* Update core/src/execution/datafusion/planner.rs

Co-authored-by: Andy Grove <andygrove73@gmail.com>

---------

Co-authored-by: Andy Grove <andygrove73@gmail.com>
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.

Different behavior of distinct count on null inputs

3 participants