Dispatch on the stored type when an aggregation function picks a value getter - #19334
Open
Jackie-Jiang wants to merge 1 commit into
Open
Dispatch on the stored type when an aggregation function picks a value getter#19334Jackie-Jiang wants to merge 1 commit into
Jackie-Jiang wants to merge 1 commit into
Conversation
…e getter FunnelEventsFunctionEvalAggregationFunction#getExtraFieldsBlocks and both switches in TimeSeriesAggregationFunction chose their BlockValSet getter by the logical value type. The getters are keyed to the stored representation, so a BOOLEAN column (stored as INT) and a JSON column (stored as STRING) were rejected as unsupported even though the getter that reads them was already in the switch. The tell was a hand-written "case TIMESTAMP:" glued onto "case LONG:" in the funnel switch. That case only existed because the dispatch was on the wrong type; BOOLEAN and JSON never got the same manual patch and so still failed. It is removed, since TIMESTAMP folds into LONG once the stored type is used. TimeSeriesAggregationFunction also gains the FLOAT case it was missing. Its numeric path reads getDoubleValuesSV, which works for every numeric stored type, so FLOAT was excluded by omission rather than by intent. The distinction is whether the code is choosing a getter or enforcing a contract. Choosing a getter must use the stored type. Enforcing a contract must not: the sketch functions gate on logical BYTES to mean "this column holds a serialized sketch" rather than values to hash, and BaseBooleanAggregationFunction rejects a non-BOOLEAN column on purpose. Both were checked and left alone, along with every dictionary.getValueType() call, which already returns the stored type. StoredTypeDispatchTest is new and covers both functions, verified by mutation. It excludes one case deliberately: for the time-series function a JSON column now reaches aggregateStringValues, but BaseTimeSeriesBuilder leaves string input unimplemented and the SUM builder throws on it, so that limitation sits downstream of this change and asserting on it would test the wrong component.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #19334 +/- ##
============================================
+ Coverage 66.97% 67.01% +0.03%
Complexity 1424 1424
============================================
Files 3463 3463
Lines 222078 222078
Branches 34957 34957
============================================
+ Hits 148743 148822 +79
+ Misses 61467 61376 -91
- Partials 11868 11880 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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.
Summary
Follow-up to #19332, where this was noticed and deliberately left out.
FunnelEventsFunctionEvalAggregationFunction#getExtraFieldsBlocksand both switches inTimeSeriesAggregationFunctionchose theirBlockValSetgetter by the logical value type. The getters arekeyed to the stored representation, so:
BOOLEANINTgetIntValuesSV()TIMESTAMPLONGLONGJSONSTRINGgetStringValuesSV()The tell was a hand-written
case TIMESTAMP:glued ontocase LONG:in the funnel switch. That case only existedbecause the dispatch was on the wrong type —
BOOLEANandJSONnever got the same manual patch, so they stillfailed. It is removed, since
TIMESTAMPfolds intoLONGonce the stored type is used.TimeSeriesAggregationFunctionalso gains theFLOATcase it was missing. Its numeric path readsgetDoubleValuesSV, which works for every numeric stored type, soFLOATwas excluded by omission rather than byintent.
What was checked and deliberately left alone
The distinction is whether the code is choosing a getter or enforcing a contract:
BYTESto mean "this column holds aserialized sketch" rather than values to hash, which is the distinction [UUID 5/8] UUID aggregation, group-by and distinct #18873 introduced; testing the stored
type there would misread a UUID column.
BaseBooleanAggregationFunctionrejects a non-BOOLEANcolumn onpurpose, and using the stored type would wrongly accept plain
INT.dictionary.getValueType()call already returns the stored type —IntDictionaryreportsINT, so aBOOLEANcolumn's dictionary reportsINT— so those are correct as written.Swept for
switchon a raw value type repo-wide and for equality comparisons across the aggregation package;these three are the complete set.
Testing
StoredTypeDispatchTestis new and covers both functions, verified by mutation — reverting either fix, or droppingthe
FLOATcase, fails the corresponding test.It excludes one case deliberately. For the time-series function a
JSONcolumn now reachesaggregateStringValues, butBaseTimeSeriesBuilderleaves string input unimplemented and theSUMbuilder throwson it. That limitation sits downstream of this change, so asserting on it here would be testing the wrong
component.
JSONis still covered on the funnel side, where all three types work.