ZhangHuiGui opened a new issue, #41336:
URL: https://github.com/apache/arrow/issues/41336
### Describe the bug, including details regarding any error messages,
version, and platform.
It's an interesting problem we find recently in `case_when` kernel.
For the call function:
`CaseWhen({MakeStruct({cond1, cond2, cond3}), {arr1, arr2, arr3, arr4}})`
will produce the `case_when` logic like below:
```shell
cond1 --> arr1 decimal(9,7),
cond2 --> arr2 decimal(6,2),
cond3 --> arr3 decimal(3, 2),
arr4 decimal(2,1)
```
The `case_when` will use the `LastType` which is `decimal(2,1)` as it's
output type.
https://github.com/apache/arrow/blob/79799e59b1a0c7bde8b85ea955593b2d63d2a46c/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L2683-L2685.
That means for the arr1/arr2/arr3's output results, the precision will be
set to `decimal(2,1)`, obviously it's inaccurate in fact especially when we the
`case_when` as an expression combining with aggregate's `sum/avg...`.
laotan332 [[email protected]](mailto:[email protected])
### Component(s)
C++
--
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]