Eshaan-byte opened a new pull request, #19206:
URL: https://github.com/apache/datafusion/pull/19206
Fixes #19174
This PR adds custom nullability handling for the Spark ILIKE function.
Previously, the function was using the default `is_nullable` which always
returns `true`, which is not correct.
## Changes
- Implemented `return_field_from_args()` to handle custom nullability logic
- The result is nullable if **any** of the input arguments is nullable
- This matches Spark's behavior where `ILIKE(NULL, pattern)` or
`ILIKE(str, NULL)` returns `NULL`
- Updated `return_type()` to use `internal_err!` pattern to enforce use of
`return_field_from_args`
- Added comprehensive nullability tests covering all combinations:
- Non-nullable when both inputs are non-nullable
- Nullable when first input is nullable
- Nullable when second input is nullable
- Nullable when both inputs are nullable
## Test Plan
All existing tests pass:
running 2 tests test function::string::ilike::tests::test_ilike_nullability
... ok test function::string::ilike::tests::test_ilike_invoke ... ok test
result: ok. 2 passed; 0 failed; 0 ignored
The implementation follows the same pattern used by other Spark functions in
the codebase (like `shuffle` and `array`)
--
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]