From 4ac460af286b4da11c274fcbbdbe05d76c74dc3c Mon Sep 17 00:00:00 2001 From: TengJianPing <18241664+jacktengg@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:09:59 +0800 Subject: [PATCH] [decimal](tests) add test case for least/greatest for decimalv3 type (#26930) --- .../math_functions/test_least_greatest.out | 7 +++++++ .../math_functions/test_least_greatest.groovy | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/regression-test/data/query_p0/sql_functions/math_functions/test_least_greatest.out b/regression-test/data/query_p0/sql_functions/math_functions/test_least_greatest.out index 42cf997c6f..54b6491ea0 100644 --- a/regression-test/data/query_p0/sql_functions/math_functions/test_least_greatest.out +++ b/regression-test/data/query_p0/sql_functions/math_functions/test_least_greatest.out @@ -323,3 +323,10 @@ zzz zzz zzz +-- !decimalv3_scale0 -- +12.34 +34.45 + +-- !decimalv3_scale1 -- +23.45 +45.56 diff --git a/regression-test/suites/query_p0/sql_functions/math_functions/test_least_greatest.groovy b/regression-test/suites/query_p0/sql_functions/math_functions/test_least_greatest.groovy index 5da23ccb25..f8bee09514 100644 --- a/regression-test/suites/query_p0/sql_functions/math_functions/test_least_greatest.groovy +++ b/regression-test/suites/query_p0/sql_functions/math_functions/test_least_greatest.groovy @@ -116,6 +116,20 @@ suite("test_least_greatest") { qt_select "SELECT GREATEST('zzz', v5) FROM test_least_greatest order by k1" sql """ drop table if exists test_least_greatest; """ + + sql """ drop table if exists test_least_greatest2; """ + sql """ + CREATE TABLE `test_least_greatest2` ( + id int, + name1 decimalv3(9,2), + name2 decimalv3(9,2) + ) DISTRIBUTED BY HASH(id) BUCKETS 1 + PROPERTIES ( "replication_allocation" = "tag.location.default: 1"); + """ + sql """insert into test_least_greatest2 values(1, 12.34, 23.45), (2, 34.45, 45.56);""" + sql "sync" + qt_decimalv3_scale0 " select least(name1, name2) from test_least_greatest2 order by name1, name2;" + qt_decimalv3_scale1 " select greatest(name1, name2) from test_least_greatest2 order by name1, name2;" }