KaranPradhan266 opened a new pull request, #19218:
URL: https://github.com/apache/datafusion/pull/19218
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
- Closes #19176
## Rationale for this change
This PR adds custom nullability handling for the Spark LIKE function.
Previously, the function was using the default is_nullable which always returns
true, which is not correct.
## What changes are included in this PR?
- 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 LIKE(NULL, pattern) or LIKE(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
## Testing
All existing tests pass, including the addition add ones.
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]