-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement GroupColumn Decimal128Array #13505
Comments
BTW we can verify that this is working as expected after merging Then you can do cd datafusion-cli
RUST_LOG=debug cargo run -- -c "create or replace table foo(x decimal(10,3), y int) as values (10.0, 100), (21.2, 200), (33.0, 300); select count(*) from foo group by x, y"; You should not see any lines about
|
take |
@alamb For this pr, will it need its own custom column implementation for decimal128 instead of instantiate_primitive!, similar to how byte, byteview, stringview, etc. are dealt with? I am thinking that due to the parameters |
I think you can use
To adjust the type at the end For example like this:
So the idea is that you keep the actual group values as native types (u128 in this case) as we are only comparing their values Does that make sense? |
Yep, thanks! |
It seems datafusion/datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.rs Line 211 in c0ca4b4
|
I think they are roughly equivalent - if we can avoid cloning the array that certainly seems better |
Is your feature request related to a problem or challenge?
In #12269 @jayzhan211 made significant improvements to how group values are stored in multi-column aggregations.
Specifically for queries like
The improvement relies on implementing specialized versions of
GroupColumn
for the types ofcol1
,colN
We have implemented the primitive types and Strings/StringViews now, but we have not implemented all types
This means queries like
Will fall back to the slower (but general)
GroupValuesRows
:datafusion/datafusion/physical-plan/src/aggregates/group_values/row.rs
Lines 40 to 41 in a6586cc
Describe the solution you'd like
Implement
GroupColumn
forDecimal128
types.You can see how to do this here:
datafusion/datafusion/physical-plan/src/aggregates/group_values/mod.rs
Lines 117 to 121 in e4bd579
@jonathanc-n also made a really nice PR here
GroupColumn
) forDate/Time/Timestamp
types #13457 (comment)and the make sure there are tests for each of those types in queries that group on multiple columns
Describe alternatives you've considered
No response
Additional context
Here is an example for how this was done for Strings: #12809
The text was updated successfully, but these errors were encountered: