From 518b1be6b3609357a49f29fe3f74c2f4300b6636 Mon Sep 17 00:00:00 2001 From: rui-mo Date: Thu, 4 Apr 2024 10:56:47 +0800 Subject: [PATCH] Add test --- velox/functions/prestosql/tests/DecimalArithmeticTest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/velox/functions/prestosql/tests/DecimalArithmeticTest.cpp b/velox/functions/prestosql/tests/DecimalArithmeticTest.cpp index 2563860ae8719..9c0d93b949c0f 100644 --- a/velox/functions/prestosql/tests/DecimalArithmeticTest.cpp +++ b/velox/functions/prestosql/tests/DecimalArithmeticTest.cpp @@ -291,6 +291,14 @@ TEST_F(DecimalArithmeticTest, multiply) { HugeInt::build(0x08FFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF)}, DECIMAL(38, 0))}), "Decimal overflow. Value '119630519620642428561342635425231011830' is not in the range of Decimal Type"); + + // The sum of input scales exceeds result precision. + VELOX_ASSERT_THROW( + evaluate( + "c0 * c0", + makeRowVector( + {makeFlatVector({1000, 2000}, DECIMAL(38, 30))})), + "DECIMAL scale must be in range [0, 38]."); } TEST_F(DecimalArithmeticTest, decimalDivTest) {