Skip to content

fix: reject inconsistent parameterized ScalarValues - #24539

Open
Theodus wants to merge 1 commit into
apache:mainfrom
Theodus:fix-scalar-iter-parameterized-types
Open

fix: reject inconsistent parameterized ScalarValues#24539
Theodus wants to merge 1 commit into
apache:mainfrom
Theodus:fix-scalar-iter-parameterized-types

Conversation

@Theodus

@Theodus Theodus commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

The ScalarValue conversion fuzz tests round-trip arrays whose scalars all have the same DataType. The generator also omits timestamps with timezones and FixedSizeBinary arrays. The tests therefore do not cover mismatched type parameters.

The added coverage exposes a bug in ScalarValue::iter_to_array. The function accepts mismatched decimal precision, decimal scale, timestamp timezone, and fixed-size binary width. It builds the array with the first scalar's parameters and discards the conflicting parameters.

What changes are included in this PR?

  • Generate timestamps with timezones and FixedSizeBinary arrays with widths 1, 8, and 32.
  • Mutate each parameter independently and verify that ScalarValue::iter_to_array rejects the mismatch.
  • Make ScalarValue::iter_to_array reject inconsistent decimal parameters, timestamp timezones, and fixed-size binary widths.
  • Reuse index and null generation across the binary array generators.

Are these changes tested?

Yes. scalar_value_iter_to_array_rejects_mixed_parameterized_types covers decimal precision, decimal scale, timestamp timezone, and fixed-size binary width mismatches. The existing roundtrip test now covers timestamps with timezones and FixedSizeBinary arrays.

Are there any user-facing changes?

Yes. ScalarValue::iter_to_array now returns an error when its inputs have different parameterized logical types. The public API signature does not change.

Validate decimal precision and scale, timestamp timezones, and fixed-size
binary widths in ScalarValue::iter_to_array.

Extend fuzz generation and mutation coverage for these parameterized
types.
@github-actions github-actions Bot added core Core DataFusion crate common Related to common crate labels Aug 20, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.55814% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.32%. Comparing base (8332cfa) to head (a797e0c).

Files with missing lines Patch % Lines
test-utils/src/array_gen/binary.rs 0.00% 16 Missing ⚠️
datafusion/common/src/scalar/mod.rs 51.85% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24539      +/-   ##
==========================================
- Coverage   81.32%   81.32%   -0.01%     
==========================================
  Files        1117     1117              
  Lines      396269   396280      +11     
  Branches   396269   396280      +11     
==========================================
- Hits       322260   322255       -5     
- Misses      55186    55197      +11     
- Partials    18823    18828       +5     

☔ 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.

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

Labels

common Related to common crate core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScalarValue::iter_to_array accepts mismatched type parameters

2 participants