AYYAPPANAYYANAN opened a new pull request, #25882: URL: https://github.com/apache/datafusion/pull/25882
## Which issue does this PR close? Closes #25875 ## Rationale for this change Async scalar UDFs that return a scalar value can fail when evaluated over batches containing multiple rows. The returned scalar is converted into an array with a single element, which can result in a record batch whose column has a different number of rows from the other columns. The scalar result should instead be expanded to match the number of rows in the batch for which the async UDF was invoked. ## What changes are included in this PR? - Preserve the number of rows for each async UDF invocation. - Use that row count when converting a scalar UDF result into an array. - Preserve the existing behavior for UDFs that return arrays. - Add a regression test covering a scalar async UDF result with a non-modular batch size. ## What is the testing strategy for this PR? Added a regression test: `test_async_udf_scalar_result_with_non_modular_batch_size` The test evaluates a scalar-returning async UDF over a three-row input with an ideal batch size of two, exercising both the two-row and one-row invocation paths. Validated locally with: `cargo test -p datafusion --test user_defined_integration test_async_udf_scalar_result_with_non_modular_batch_size -- --nocapture` Result: 1 passed, 0 failed. Also ran: `cargo fmt --all -- --check` `git diff --check` ## Are there any user-facing changes? Yes. This fixes incorrect execution of scalar-returning async UDFs for multi-row batches. There are no public API changes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
