Skip to content

[C++][Compute] Normalize decimal value arguments in choose DispatchBest#78

Draft
zanmato1984 wants to merge 1 commit into
mainfrom
codex/choose-decimal-dispatch
Draft

[C++][Compute] Normalize decimal value arguments in choose DispatchBest#78
zanmato1984 wants to merge 1 commit into
mainfrom
codex/choose-decimal-dispatch

Conversation

@zanmato1984

Copy link
Copy Markdown
Owner

Summary

  • normalize decimal value arguments in choose DispatchBest after index promotion
  • require decimal choose exact matches to already share the same decimal type so binding falls back to DispatchBest when rescaling is needed
  • add focused dispatch and expression-binding regression coverage for mixed-scale decimal choose calls

Root cause

choose was missing the decimal normalization step that if_else, case_when, and coalesce already apply on their best-dispatch path. Separately, the decimal varargs kernels for choose were permissive enough to satisfy exact dispatch for mixed-scale decimal arguments, which let expression binding bypass DispatchBest entirely and keep mismatched decimal value types.

What changed

After promoting the index argument to int64, ChooseFunction::DispatchBest now runs decimal normalization across the value arguments before selecting the kernel. The decimal choose kernels also now carry a match constraint that only allows exact dispatch when all decimal value arguments already have the same type, so expression binding inserts the expected casts instead of short-circuiting.

Testing

  • arrow-compute-expression-test --gtest_filter='Expression.BindWithImplicitCastsForChooseOnDecimal'
  • arrow-compute-scalar-if-else-test --gtest_filter='TestChooseKernel.DispatchBest'
  • arrow-compute-scalar-if-else-test --gtest_filter='TestChoose.*:TestChooseKernel.*'

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant