Chetansahney opened a new pull request, #55962: URL: https://github.com/apache/arrow/pull/55962
### Rationale for this change `if_else` crashes the process when the condition is not boolean and both values have the same dictionary type: ```python values = pa.array(["a", "b"]).dictionary_encode() pc.if_else(pa.array([1, 0]), values, values) ``` `IfElseFunction::DispatchBest` sends identical dictionary types to `DispatchExactImpl` and returns the result after only a `DCHECK(kernel)`. No kernel matches a non-boolean condition, so release builds return a null kernel and then call it. ### What changes are included in this PR? The dictionary branch now returns `NoMatchingKernel` when `DispatchExactImpl` finds nothing, which is what the non-dictionary path already does. ### Are these changes tested? Yes. `TestIfElse.DictionaryNonBooleanCondition` checks the error for an int64 condition with dictionary values, including a null scalar as the second value. It fails without the change. `arrow-compute-scalar-if-else-test` passes in full (Windows, MSVC, Release). ### Are there any user-facing changes? The call above now raises `ArrowNotImplementedError: Function 'if_else' has no kernel matching input types` instead of crashing. **This PR contains a "Critical Fix".** It fixes a crash (segmentation fault) on user input. ### Was AI used for this PR? In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR. **PR code and description written by:** - [ ] Human - [x] AI **Reviewed before submission by:** - [x] Human - [ ] AI - [ ] Not reviewed * GitHub Issue: #55960 -- 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]
