Skip to content

fix: preserve async UDF return field metadata#22663

Open
Kontinuation wants to merge 1 commit into
apache:mainfrom
Kontinuation:fix-async-udf-field-metadata
Open

fix: preserve async UDF return field metadata#22663
Kontinuation wants to merge 1 commit into
apache:mainfrom
Kontinuation:fix-async-udf-field-metadata

Conversation

@Kontinuation
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #22662.

Rationale for this change

Async scalar UDFs can compute output field metadata in return_field_from_args(...), but AsyncFuncExpr rebuilt the output field from only name, data type, and nullability. This dropped metadata from async UDF result fields.

What changes are included in this PR?

This PR updates AsyncFuncExpr::field(...) to preserve the planned return_field metadata and only rename the field for the async expression output.

It also adds a regression test that verifies an async UDF result batch preserves metadata attached by return_field_from_args(...).

Are these changes tested?

Yes.

Added a regression test in:

  • datafusion/core/tests/user_defined/user_defined_async_scalar_functions.rs

The test fails without the fix and passes with the fix.

Are there any user-facing changes?

Yes.

Async scalar UDF result fields now preserve metadata attached by return_field_from_args(...).

@github-actions github-actions Bot added physical-expr Changes to the physical-expr crates core Core DataFusion crate labels May 31, 2026
@Kontinuation Kontinuation force-pushed the fix-async-udf-field-metadata branch from 9d1f609 to 7b117e0 Compare May 31, 2026 12:15
Copy link
Copy Markdown
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

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

To the extent that I'm qualified to approve these things, this looks good to me!

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.

AsyncFuncExpr drops async UDF return field metadata

2 participants