zanmato1984 opened a new pull request, #50870:
URL: https://github.com/apache/arrow/pull/50870

   ### Rationale for this change
   
   Expression binding tries `DispatchExact` before `DispatchBest`. The 
`coalesce` decimal varargs kernels used broad decimal signatures, so mixed 
concrete decimal types could exact-match and bypass the existing decimal 
normalization and cast insertion in `DispatchBest`. Executing the resulting 
bound expression then failed with a type compatibility error.
   
   ### What changes are included in this PR?
   
   - Add a decimal-only `MatchConstraint` requiring all `coalesce` arguments to 
have the same full decimal `DataType` for exact dispatch.
   - Attach the constraint to decimal128 and decimal256 kernel registrations.
   - Add dispatch, expression-binding, and end-to-end regressions covering 
same-scale/different-precision, crossed precision/scale, reversed argument 
order, and decimal128/decimal256 inputs.
   
   ### Are these changes tested?
   
   Yes. I ran:
   
   - `arrow-compute-expression-test 
--gtest_filter='Expression.BindWithImplicitCastsForCoalesceOnDecimal:Expression.ExecuteCoalesceOnMixedDecimalTypes'`
   - `arrow-compute-scalar-if-else-test 
--gtest_filter='TestCoalesce.*:TestCoalesceNumeric.*:TestCoalesceBinary.*:TestCoalesceList.*'`
   
   The expression tests (2 tests) and complete `TestCoalesce` selection (13 
tests) passed locally.
   
   ### AI assistance
   
   I used an AI coding assistant to help inspect the existing `MatchConstraint` 
patterns, draft the implementation and regression tests, and prepare the issue 
and pull request text. I reviewed and revised the generated changes, reproduced 
the bug on current `main`, verified the dispatch and expression-binding 
behavior before and after the fix, and ran the tests listed above. I understand 
and take responsibility for the submitted changes. No external copyrighted 
material was incorporated.
   
   ### Are there any user-facing changes?
   
   Yes. `coalesce` expressions with compatible mixed decimal types now bind 
with casts to a common decimal type and execute successfully instead of failing 
with a type compatibility error.
   
   * GitHub Issue: #50869
   


-- 
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]

Reply via email to