BootstrapperSBL opened a new pull request, #21808:
URL: https://github.com/apache/datafusion/pull/21808
## Which issue does this PR close?
- Closes #21798.
## Rationale for this change
`coerced_from` in `datafusion/expr/src/type_coercion/functions.rs` handles
`(Utf8View, Utf8 | LargeUtf8 | Null)` but the symmetric arm for `BinaryView`
was missing. That meant a scalar UDF declared with
```rust
Signature::exact(vec![DataType::BinaryView], Volatility::Immutable)
```
would reject `Binary`/`LargeBinary` columns (and untyped `Null` placeholders)
during planning, even though the analogous Utf8View-family call works fine.
### Before
```text
Error: type_coercion
caused by
Error during planning: Failed to coerce arguments to satisfy a call to
'my_udf' function:
coercion from [Binary] to the signature Exact([BinaryView]) failed.
```
### After
```text
# Binary / LargeBinary / Null all coerce into BinaryView
[BinaryView]
```
## What changes are included in this PR?
- Add `(BinaryView, Binary | LargeBinary | Null) => Some(type_into.clone())`
in `coerced_from`, directly mirroring the Utf8View arm above it.
- Extend `test_string_conversion` to cover the three new BinaryView cases and
the previously uncovered `Utf8View <- Null` case.
- Add `test_binaryview_signature_accepts_binary_columns`, which exercises the
fix through `fields_with_udf` with a real
`Signature::exact(vec![BinaryView], ...)`
so regressions show up at the coercion-entry level, not just inside
`coerced_from`.
## Are these changes tested?
Yes:
- `cargo test -p datafusion-expr` (all 18 functions::tests pass, including
the
new `test_binaryview_signature_accepts_binary_columns`).
- `cargo fmt --all --check`.
- `cargo clippy --all-targets --workspace --features
"avro,integration-tests,extended_tests" -- -D warnings`.
## Are there any user-facing changes?
Yes, but strictly additive: existing call sites keep compiling, and calls
that
used to fail planning with a `BinaryView` signature now succeed by coercing
`Binary`/`LargeBinary`/`Null` arguments into `BinaryView`. No public API is
changed and no breaking behaviour is introduced.
--
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]