-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] DCHECK_EQ failed in ResolveDecimalAdditionOrSubtractionOutput function when execute two different decimal scale arrays' add #40126
Comments
@westonpace I have seen your response in #35843, maybe we could solve the problem internal rather than restricting user behavior(eg. explicit call cast for decimal compute in expressions)? |
I'm not sure I understand. Are you suggesting we visit the expression tree and insert casts when receive expressions involving decimals? |
…nd failed in resolve type when call arithmetic function (#40223) ### Rationale for this change Fix decimal types with different precisions and scales bind failed in resolve type when call arithmetic function. ### What changes are included in this PR? Add `IsNeedDispatchBest` function to check the decimal types and arithmetic functions, if success we will go into the dispatchBest path and do the implicit cast correctly. ### Are these changes tested? Yes ### Are there any user-facing changes? Yes, user needn't do their own cast for decimal related logic. * GitHub Issue: #40126 Authored-by: hugo.zhang <hugo.zhang@openpie.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Issue resolved by pull request 40223 |
…les bind failed in resolve type when call arithmetic function (apache#40223) ### Rationale for this change Fix decimal types with different precisions and scales bind failed in resolve type when call arithmetic function. ### What changes are included in this PR? Add `IsNeedDispatchBest` function to check the decimal types and arithmetic functions, if success we will go into the dispatchBest path and do the implicit cast correctly. ### Are these changes tested? Yes ### Are there any user-facing changes? Yes, user needn't do their own cast for decimal related logic. * GitHub Issue: apache#40126 Authored-by: hugo.zhang <hugo.zhang@openpie.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Describe the bug, including details regarding any error messages, version, and platform.
How to reproduce
Add two different precision and scale decimal arrays through expression.
The test will crash at below function's
DCHECK_EQ
because the input types' scale is different duringarrow::compute::Expression::Bind
.The
CallFunction
is correct.Reason
The expression's bind function will skip
DispatchBest
inBindNonRecursive
. BecauseDispatchExact
will return ok and skip theDispatchBest
which overrided byArithmeticFunction
.So the implicit cast in
ArithmeticFunction::DispatchBest
for decimal will be skipped.But the logic is correct in
CallFunction
which will callDispatchBest
first.If we want to let user do cast by theirselves in expression call, we should return an error if we checked current situation? Or return not-ok in DispatchExact for decimal special case?
Component(s)
C++
The text was updated successfully, but these errors were encountered: