Skip to content

[branch-54] Expand scalar async UDF results to the batch row count (#25828) - #27372

Merged
alamb merged 2 commits into
apache:branch-54from
kamilk-pal:backport-25828-branch-54
Nov 12, 2026
Merged

alamb merged 2 commits into
apache:branch-54from
kamilk-pal:backport-25828-branch-54

Conversation

@kamilk-pal

Copy link
Copy Markdown

## Which issue does this PR close?

- Closes apache#25875

## Rationale for this change

When an async UDF returns a `ColumnarValue::Scalar` (e.g. all arguments
are literals), queries on more than one row fail with `all columns in a
record batch must have the same length`.

## What changes are included in this PR?

`AsyncFuncExpr::invoke_with_args` expands each result to its chunk's row
count via `into_array_of_size`, instead of turning a scalar into a 1-row
array.

## What is the testing strategy for this PR?

Added `test_async_udf_with_scalar_result` in
`user_defined_async_scalar_functions.rs`. It fails without the fix.

## Are there any user-facing changes?

No.

(cherry picked from commit 1aed7dc)
@github-actions github-actions Bot added physical-expr Changes to the physical-expr crates core Core DataFusion crate labels Nov 12, 2026

@hareshkh hareshkh 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.

Honest backport of the original PR

@alamb
alamb enabled auto-merge (squash) November 12, 2026 21:31

@alamb alamb 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.

Thanks @kamilk-pal and @hareshkh

@alamb
alamb merged commit 33032d8 into apache:branch-54 Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants