feat: add GroupColumn support for Decimal256 in multi-column GROUP BY#23849
Open
tohuya6 wants to merge 1 commit into
Open
feat: add GroupColumn support for Decimal256 in multi-column GROUP BY#23849tohuya6 wants to merge 1 commit into
tohuya6 wants to merge 1 commit into
Conversation
…column GROUP BY `multi_group_by::group_column_supported_type` gates which GROUP BY columns can use the column-wise `GroupValuesColumn` fast path. Any unsupported column forces the entire grouping onto the byte-encoded `GroupValuesRows` fallback, so a single `Decimal256` key dragged an otherwise-qualifying multi-column GROUP BY onto the slow path. `Decimal256` mirrors the existing `Decimal128` arm and reuses `PrimitiveGroupValueBuilder` with no new builder type: its `i256` native is `Copy`, implements `ArrowNativeTypeOp`, and already implements `HashValue` via `hash_integer!`, and the precision/scale round-trips through the builder's stored `DataType`. - dispatch `Decimal256(_, _)` in `make_group_column` - accept `Decimal256(_, _)` in `group_column_supported_type` - move `Decimal256` from the unsupported to the supported set in the `group_column_supported_type` <-> `make_group_column` consistency fuzz - add an end-to-end unit test (Decimal256 GROUP BY dedups including nulls and preserves the Decimal256 precision/scale output type; uses precision > 38 so it is genuinely Decimal256) and a Decimal256 GROUP BY block (single- and multi-column keys) in aggregate.slt - add a `(Decimal256, Int32)` group-count benchmark to `benches/multi_group_by.rs` Part of apache#22715
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
multi_group_by::group_column_supported_typegates which GROUP BY columns mayuse the column-wise
GroupValuesColumnfast path, and the gate isall-or-nothing: a single unsupported column forces the entire grouping onto
the byte-encoded
GroupValuesRowsfallback, even when every other key columnwould have qualified. A
Decimal256key triggers exactly that today.Although
i256is a 32-byte native rather than a machine-word scalar, it isCopyand already implementsArrowNativeTypeOp+HashValue, soDecimal256reuses the existing
PrimitiveGroupValueBuilderwith no new builder type and noT: Copyrelaxation — it mirrors theDecimal128arm that already exists.What changes are included in this PR?
Decimal256Typeinmake_group_column, mirroring theDecimal128arm.Decimal256(_, _)ingroup_column_supported_type.group_column_supported_type↔make_group_columnconsistencyfuzz:
Decimal256previously served as the stock unsupported example, so itmoves into the supported set (
Float16/ invalidTimeunit combinationsremain as the negative examples).
Decimal256group-count benchmark tobenches/multi_group_by.rs.Are these changes tested?
Yes.
Decimal256key (precision > 38, so genuinely 256-bit) stayson the
GroupValuesColumnpath, dedups including nulls, and round-trips withthe
Decimal256(precision, scale)output type preserved.Decimal256routes through the dispatcher.Decimal256GROUP BYcoverage inaggregate.slt.Are there any user-facing changes?
No API changes.
GROUP BYqueries with aDecimal256key now use thecolumn-wise fast path instead of the row-encoded fallback; results are unchanged.