Skip to content

fix: support untyped NULL input for median - #24104

Open
Sigma-Ma wants to merge 1 commit into
apache:mainfrom
Sigma-Ma:fix-median-null-24077
Open

fix: support untyped NULL input for median#24104
Sigma-Ma wants to merge 1 commit into
apache:mainfrom
Sigma-Ma:fix-median-null-24077

Conversation

@Sigma-Ma

@Sigma-Ma Sigma-Ma commented Aug 5, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

median(NULL) worked in DataFusion 53 but regressed in DataFusion 54. The untyped NULL argument remained DataType::Null, causing physical planning to create a median accumulator for an unsupported input type.

What changes are included in this PR?

  • Use explicit type coercion for median.
  • Coerce untyped NULL and integer inputs to Float64.
  • Preserve Float and Decimal input types.
  • Add a SQL logic regression test for median(NULL).

Are these changes tested?

Yes.

  • cargo fmt --all -- --check
  • cargo test --profile=ci --test sqllogictests -- aggregate.slt
  • cargo test -p datafusion-functions-aggregate
  • cargo clippy -p datafusion-functions-aggregate --all-targets --all-features -- -D warnings

Are there any user-facing changes?

Yes. median(NULL) now returns a typed Float64 NULL instead of failing during physical execution.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Aug 5, 2026
@Sigma-Ma

Sigma-Ma commented Aug 5, 2026

Copy link
Copy Markdown
Author

Hi, this is my first contribution to DataFusion. Could a committer please trigger CI when convenient? Thanks!

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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug + Regression: median(null) fails in v54

1 participant