Describe the bug, including details regarding any error messages, version, and platform.
Our CompareFunction has it's own DispatchBest and supposed do cast with kAdd promotion rule during Bind.
| Result<const Kernel*> DispatchBest(std::vector<TypeHolder>* types) constoverride { |
| RETURN_NOT_OK(CheckArity(types->size())); |
| if (HasDecimal(*types)) { |
| RETURN_NOT_OK(CastBinaryDecimalArgs(DecimalPromotion::kAdd, types)); |
| } |
But we haven't check the input decimal types' scale as ResolveDecimalAdditionOrSubtractionOutput does.
| for (constauto id : {Type::DECIMAL128, Type::DECIMAL256}) { |
| auto exec = GenerateDecimal<applicator::ScalarBinaryEqualTypes, BooleanType, Op>(id); |
| DCHECK_OK( |
| func->AddKernel({InputType(id), InputType(id)}, boolean(), std::move(exec))); |
| } |
So the decimal array's comparison won't be casted and it's results will wrong when input decimal's scales are same.
Component(s)
C++
Describe the bug, including details regarding any error messages, version, and platform.
Our
CompareFunctionhas it's ownDispatchBestand supposed do cast with kAdd promotion rule during Bind.arrow/cpp/src/arrow/compute/kernels/scalar_compare.cc
Lines 341 to 345 in 72d20ad
But we haven't check the input decimal types' scale as
ResolveDecimalAdditionOrSubtractionOutputdoes.arrow/cpp/src/arrow/compute/kernels/scalar_compare.cc
Lines 435 to 439 in 72d20ad
So the decimal array's comparison won't be casted and it's results will wrong when input decimal's scales are same.
Component(s)
C++