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:
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.
|
ScalarKernel kernel( |
|
KernelSignature::Make({InputType(Type::STRUCT), InputType(get_id.id)}, LastType, |
|
/*is_varargs=*/true), |
.
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 the case_when as an expression combining with aggregate's sum/avg....
laotan332 qinpengxiang@outlook.com
Component(s)
C++
Describe the bug, including details regarding any error messages, version, and platform.
It's an interesting problem we find recently in
case_whenkernel.For the call function:
CaseWhen({MakeStruct({cond1, cond2, cond3}), {arr1, arr2, arr3, arr4}})will produce the
case_whenlogic like below:The
case_whenwill use theLastTypewhich isdecimal(2,1)as it's output type.arrow/cpp/src/arrow/compute/kernels/scalar_if_else.cc
Lines 2683 to 2685 in 79799e5
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 thecase_whenas an expression combining with aggregate'ssum/avg....laotan332 qinpengxiang@outlook.com
Component(s)
C++