diff --git a/dbms/src/Functions/divide.cpp b/dbms/src/Functions/divide.cpp index 132f6fae623..a0ba895b78b 100644 --- a/dbms/src/Functions/divide.cpp +++ b/dbms/src/Functions/divide.cpp @@ -65,7 +65,7 @@ struct TiDBDivideFloatingImpl /// ref https://github.com/pingcap/tiflash/issues/6462 /// For division of Decimal/Decimal or Int/Decimal or Decimal/Int, we should round the result to make compatible with TiDB. /// basically refer to https://stackoverflow.com/a/71634489 - if constexpr (std::is_integral_v || std::is_same_v) + if constexpr (std::is_integral_v || std::is_same_v || std::is_same_v) { /// 1. do division first, get the quotient and mod, todo:(perf) find a unified `divmod` function to speed up this. Result quotient = x / d; diff --git a/dbms/src/Functions/tests/gtest_arithmetic_functions.cpp b/dbms/src/Functions/tests/gtest_arithmetic_functions.cpp index 4ba24d677f3..4fdfdb3fb15 100644 --- a/dbms/src/Functions/tests/gtest_arithmetic_functions.cpp +++ b/dbms/src/Functions/tests/gtest_arithmetic_functions.cpp @@ -154,6 +154,7 @@ try doTiDBDivideDecimalRoundInternalTest(); doTiDBDivideDecimalRoundInternalTest(); doTiDBDivideDecimalRoundInternalTest(); + doTiDBDivideDecimalRoundInternalTest(); } CATCH