Skip to content

Fix SmartHLL ClassCastException in GROUP BY ORDER BY#18841

Open
ilamhs wants to merge 1 commit into
apache:masterfrom
ilamhs:fix/smart-hll-group-by-classcast
Open

Fix SmartHLL ClassCastException in GROUP BY ORDER BY#18841
ilamhs wants to merge 1 commit into
apache:masterfrom
ilamhs:fix/smart-hll-group-by-classcast

Conversation

@ilamhs

@ilamhs ilamhs commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

extractGroupByResult() blindly cast to Set but the holder can contain a HyperLogLog once the dict-ID cardinality threshold is exceeded via checkAndConvertToSketchForGroups. Mirror the threshold check already present in extractAggregationResult().

Labels: bugfix

extractGroupByResult() blindly cast to Set but the holder can contain a
HyperLogLog once the dict-ID cardinality threshold is exceeded via
checkAndConvertToSketchForGroups. Mirror the threshold check already present
in extractAggregationResult().
Comment on lines +517 to +522
if (result instanceof DictIdsWrapper dictIdsWrapper) {
if (dictIdsWrapper._dictIdBitmap.cardinalityExceeds(getThreshold())) {
return convertToSketch(dictIdsWrapper);
} else {
return convertToValueSet(dictIdsWrapper);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to change this part given the check is already performed during the aggregate

@Jackie-Jiang Jackie-Jiang added bug Something is not working as expected query Related to query processing labels Jun 23, 2026
@codecov-commenter

codecov-commenter commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.78%. Comparing base (63bf8dc) to head (bc04586).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...seDistinctCountSmartSketchAggregationFunction.java 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18841      +/-   ##
============================================
+ Coverage     64.76%   64.78%   +0.01%     
  Complexity     1322     1322              
============================================
  Files          3393     3393              
  Lines        211022   211024       +2     
  Branches      33135    33136       +1     
============================================
+ Hits         136676   136714      +38     
+ Misses        63330    63282      -48     
- Partials      11016    11028      +12     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.78% <60.00%> (+0.01%) ⬆️
temurin 64.78% <60.00%> (+0.01%) ⬆️
unittests 64.78% <60.00%> (+0.01%) ⬆️
unittests1 56.96% <60.00%> (-0.02%) ⬇️
unittests2 37.21% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is not working as expected query Related to query processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants