Skip to content

fix: derive custom nullability for spark map_from_arrays#19275

Merged
comphead merged 1 commit intoapache:mainfrom
kumarUjjawal:fix/map_from_arrays_nullable
Dec 12, 2025
Merged

fix: derive custom nullability for spark map_from_arrays#19275
comphead merged 1 commit intoapache:mainfrom
kumarUjjawal:fix/map_from_arrays_nullable

Conversation

@kumarUjjawal
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

  • Spark map_from_arrays now uses return_field_from_args to handle nullability

Are these changes tested?

  • New unit tests are added
  • All previous tests pass

Are there any user-facing changes?

@github-actions github-actions Bot added the spark label Dec 11, 2025
Copy link
Copy Markdown
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

Thanks @kumarUjjawal

@comphead comphead added this pull request to the merge queue Dec 12, 2025
Merged via the queue into apache:main with commit 96ddd55 Dec 12, 2025
27 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Feb 2, 2026
## Which issue does this PR close?

- Closes #19870.

## Rationale for this change

Some UDFs/UDAFs implement `return_field_from_args` / `return_field`
instead of `return_type`. The information schema was calling
`return_type` directly, which fails for those functions. The default
implementation of `return_field_from_args` already delegates to
`return_type`, so switching to the newer API works for all functions.

## What changes are included in this PR?

- **`information_schema.rs`**: `get_udf_args_and_return_types` now calls
`return_field_from_args` instead of `return_type`;
`get_udaf_args_and_return_types` now calls `return_field` instead of
`return_type`. Removed stale comments referencing the old API.
- **`date_trunc.rs`**: `return_type` now returns `internal_err`, and
`return_field_from_args` is self-contained (no longer delegates to
`return_type`), following the same pattern as other UDFs like
`named_struct` and `map_from_arrays` (ref: #19275).

## Are these changes tested?

Covered by existing information_schema sqllogictests and
`datafusion-functions` unit tests.

## Are there any user-facing changes?

No.
de-bgunter pushed a commit to de-bgunter/datafusion that referenced this pull request Mar 24, 2026
…he#20079)

## Which issue does this PR close?

- Closes apache#19870.

## Rationale for this change

Some UDFs/UDAFs implement `return_field_from_args` / `return_field`
instead of `return_type`. The information schema was calling
`return_type` directly, which fails for those functions. The default
implementation of `return_field_from_args` already delegates to
`return_type`, so switching to the newer API works for all functions.

## What changes are included in this PR?

- **`information_schema.rs`**: `get_udf_args_and_return_types` now calls
`return_field_from_args` instead of `return_type`;
`get_udaf_args_and_return_types` now calls `return_field` instead of
`return_type`. Removed stale comments referencing the old API.
- **`date_trunc.rs`**: `return_type` now returns `internal_err`, and
`return_field_from_args` is self-contained (no longer delegates to
`return_type`), following the same pattern as other UDFs like
`named_struct` and `map_from_arrays` (ref: apache#19275).

## Are these changes tested?

Covered by existing information_schema sqllogictests and
`datafusion-functions` unit tests.

## Are there any user-facing changes?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spark map_from_arrays need to have custom nullability

2 participants