feat: add GroupColumn support for Interval in multi-column GROUP BY#23786
Open
tohuya6 wants to merge 1 commit into
Open
feat: add GroupColumn support for Interval in multi-column GROUP BY#23786tohuya6 wants to merge 1 commit into
tohuya6 wants to merge 1 commit into
Conversation
…lumn 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 `Interval` key dragged an otherwise-qualifying multi-column GROUP BY onto the slow path. All three `Interval` units reuse the existing `PrimitiveGroupValueBuilder` with no new builder type and no new `HashValue` impl (the `i32` / `IntervalDayTime` / `IntervalMonthDayNano` natives already implement it): - dispatch the three `Interval*Type` units in `make_group_column`; `IntervalUnit` has exactly three variants, so the match is exhaustive with no fallback arm (unlike Time32 / Time64, which must reject invalid unit combinations) - accept `Interval(_)` in `group_column_supported_type` - extend the `group_column_supported_type` <-> `make_group_column` consistency fuzz with the three Interval units - add an end-to-end unit test (Interval GROUP BY dedups including nulls, keeps "1 month" and "30 days" as distinct groups with no cross-unit folding, and preserves the Interval output type) and an Interval GROUP BY block (single- and multi-column keys) in aggregate.slt - add an `(Interval, Int32)` group-count benchmark to `benches/multi_group_by.rs` Part of apache#22715
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23786 +/- ##
==========================================
- Coverage 80.71% 80.71% -0.01%
==========================================
Files 1089 1089
Lines 368760 368798 +38
Branches 368760 368798 +38
==========================================
+ Hits 297647 297666 +19
- Misses 53372 53382 +10
- Partials 17741 17750 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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. An
Intervalkey triggers exactly that today.All three
Intervalunits reuse the existingPrimitiveGroupValueBuilderwithno new builder type and no new
HashValueimpl — thei32/IntervalDayTime/
IntervalMonthDayNanonatives already implement it.What changes are included in this PR?
Interval*Typeunits inmake_group_column.IntervalUnithas exactly three variants, so the match is exhaustive with no fallback arm
(unlike
Time32/Time64, which must reject invalid unit combinations).Interval(_)ingroup_column_supported_type.group_column_supported_type↔make_group_columnconsistencyfuzz with the three Interval units.
(Interval, Int32)group-count benchmark tobenches/multi_group_by.rs.Are these changes tested?
Yes.
Intervalkey stays on theGroupValuesColumnpath, dedupsincluding nulls, keeps "1 month" and "30 days" as distinct groups (no
cross-unit folding), and round-trips with the
Intervaloutput type preserved.dispatcher.
IntervalGROUP BYcoverage inaggregate.slt.Are there any user-facing changes?
No API changes.
GROUP BYqueries with anIntervalkey now use thecolumn-wise fast path instead of the row-encoded fallback; results are unchanged.