From 238395e28217fd904fb5400fbd0790e06deb5474 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 18 Jul 2022 14:35:07 +0800 Subject: [PATCH] [Bug] fix decimal arithmetic calculations (#10963) --- be/src/vec/functions/function_binary_arithmetic.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/be/src/vec/functions/function_binary_arithmetic.h b/be/src/vec/functions/function_binary_arithmetic.h index f3bc32f074..982871220a 100644 --- a/be/src/vec/functions/function_binary_arithmetic.h +++ b/be/src/vec/functions/function_binary_arithmetic.h @@ -745,14 +745,11 @@ private: OpTraits::is_division); typename ResultDataType::FieldType scale_a; typename ResultDataType::FieldType scale_b; - if constexpr (OpTraits::is_division && IsDataTypeDecimal) { - scale_a = type_right.get_scale_multiplier(); - scale_b = 1; - } else { - scale_a = type.scale_factor_for(type_left, OpTraits::is_multiply); - scale_b = type.scale_factor_for(type_right, - OpTraits::is_multiply || OpTraits::is_division); - } + + // TODO(Gabriel): precision and scale need to be processed for decimalv3, now we just + // keep the same behavior as before + scale_a = type.scale_factor_for(type_left, OpTraits::is_multiply); + scale_b = type.scale_factor_for(type_right, OpTraits::is_multiply || OpTraits::is_division); return std::make_tuple(type, scale_a, scale_b); }