Skip to content

fix: unwrap nested encodings inside Dictionary arguments to MIN/MAX - #26371

Merged
Jefffrey merged 2 commits into
apache:mainfrom
polarsignals:fix-min-max-nested-dictionary
Oct 25, 2026
Merged

Jefffrey merged 2 commits into
apache:mainfrom
polarsignals:fix-min-max-nested-dictionary

Conversation

@grevend

@grevend grevend commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

MIN/MAX fail with an internal error on Dictionary<_, RunEndEncoded<_, _>> columns, and return a Dictionary type instead of the value type for Dictionary<_, Dictionary<_, _>> columns. See #26290.

What changes are included in this PR?

The Dictionary arm of get_min_max_result_type now recurses into its value type, the same as the RunEndEncoded arm added in #26248.

What is the testing strategy for this PR?

  • test_get_min_max_return_type_coerce_dictionary covers Dictionary<Int32, RunEndEncoded<Int32, UInt32>> → UInt32 and Dictionary<Int32, Dictionary<Int32, UInt32>> → UInt32.
  • New cases in dictionary.slt run MIN/MAX and arrow_typeof(MAX(...)) over both column types, one query per type.

Without the fix, the Dictionary<_, RunEndEncoded<_, _>> query fails with the internal error, and the Dictionary<_, Dictionary<_, _>> query returns a Dictionary type.

Are there any user-facing changes?

MIN and MAX over a Dictionary column whose values are encoded now return the plain value type. There are no API changes.

Generated-by: Claude Code (Claude Opus 5.5). I reviewed the change and can answer for it.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 15, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.85%. Comparing base (c52eb97) to head (ca9988f).

Files with missing lines Patch % Lines
datafusion/functions-aggregate/src/min_max.rs 83.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26371      +/-   ##
==========================================
- Coverage   82.85%   82.85%   -0.01%     
==========================================
  Files        1151     1151              
  Lines      455996   456007      +11     
  Branches   455996   456007      +11     
==========================================
+ Hits       377805   377811       +6     
+ Misses      55239    55238       -1     
- Partials    22952    22958       +6     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@grevend

grevend commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@Jefffrey this is the follow-up you suggested on #26248: the Dictionary arm now recurses like the RunEndEncoded one. Would you have time to take a look?

@Rich-T-kid Rich-T-kid left a comment

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.

Looks good to me! thanks @grevend

@Jefffrey
Jefffrey enabled auto-merge October 25, 2026 09:02
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks

@Jefffrey
Jefffrey added this pull request to the merge queue Oct 25, 2026
Merged via the queue into apache:main with commit e3fe60c Oct 25, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt) v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MIN/MAX don't unwrap nested encodings inside Dictionary columns

4 participants