-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add support for dictionary for approx_distinct #24646
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -840,6 +840,7 @@ impl AggregateUDFImpl for ApproxDistinct { | |
| | DataType::Map(_, _) | ||
| | DataType::Struct(_) | ||
| | DataType::Union(_, _) | ||
| | DataType::Dictionary(_, _) | ||
| | DataType::LargeBinary => Box::new(HLLAccumulator::new()), | ||
| DataType::Null => { | ||
| Box::new(NoopAccumulator::new(ScalarValue::UInt64(Some(0)))) | ||
|
|
@@ -919,6 +920,7 @@ fn is_hll_groups_type(data_type: &DataType) -> bool { | |
| | DataType::Map(_, _) | ||
| | DataType::Struct(_) | ||
| | DataType::Union(_, _) | ||
| | DataType::Dictionary(_, _) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it make sense to have both dictionary arms on the value type, so
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a good point
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea. Thank you! |
||
| ) | ||
| } | ||
|
|
||
|
|
||
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.
Would it work to match on the value type instead, so a dictionary is supported exactly when its values would be? Something like
DataType::Dictionary(_, value_type)Uh oh!
There was an error while loading. Please reload this page.
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.
Good point. Floats will be unsupported see #23084, So we should exclude them in all container types.
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.
i still feel we can support floats here if we already support it in regular distinct count 🤔
also for reference seems duckdb supports:
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.
Ok makes sense. I will look into this.