From 96cfc81baeab64f0f5bcc92a57da7b88d6c7210c Mon Sep 17 00:00:00 2001 From: jacktengg <18241664+jacktengg@users.noreply.github.com> Date: Sat, 7 Oct 2023 18:15:03 +0800 Subject: [PATCH] regression test --- be/src/runtime/raw_value.h | 2 ++ .../datatype_p0/decimalv3/test_decimalv3.out | 24 +++++++++++++++++++ .../decimalv3/test_decimalv3.groovy | 15 ++++++++++++ 3 files changed, 41 insertions(+) diff --git a/be/src/runtime/raw_value.h b/be/src/runtime/raw_value.h index b1e635ea1693a1..1990d11023d4ee 100644 --- a/be/src/runtime/raw_value.h +++ b/be/src/runtime/raw_value.h @@ -103,6 +103,8 @@ inline uint32_t RawValue::zlib_crc32(const void* v, size_t len, const PrimitiveT return HashUtil::zlib_crc_hash(v, 8, seed); case TYPE_DECIMAL128I: return HashUtil::zlib_crc_hash(v, 16, seed); + case TYPE_DECIMAL256: + return HashUtil::zlib_crc_hash(v, 32, seed); default: DCHECK(false) << "invalid type: " << type; return 0; diff --git a/regression-test/data/datatype_p0/decimalv3/test_decimalv3.out b/regression-test/data/datatype_p0/decimalv3/test_decimalv3.out index 0482cc4164a7c7..7466b0f4098df9 100644 --- a/regression-test/data/datatype_p0/decimalv3/test_decimalv3.out +++ b/regression-test/data/datatype_p0/decimalv3/test_decimalv3.out @@ -5,6 +5,30 @@ -- !decimalv3 -- 100.00000000000000000000 +-- !decimalv3_0 -- +1.000000 9999999999999999999999999999999999999999999999999999999999999999999999.999999 +2.000000 4999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_1 -- +1.000000 9999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_2 -- +2.000000 4999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_3 -- +1.000000 9999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_4 -- +1.000000 9999999999999999999999999999999999999999999999999999999999999999999999.999999 +2.000000 4999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_5 -- +2.000000 4999999999999999999999999999999999999999999999999999999999999999999999.999999 + +-- !decimalv3_6 -- +1.000000 9999999999999999999999999999999999999999999999999999999999999999999999.999999 +2.000000 4999999999999999999999999999999999999999999999999999999999999999999999.999999 + -- !aEb_test1 -- 0 diff --git a/regression-test/suites/datatype_p0/decimalv3/test_decimalv3.groovy b/regression-test/suites/datatype_p0/decimalv3/test_decimalv3.groovy index 2b72c36867bba1..d8a0e34e01a1e1 100644 --- a/regression-test/suites/datatype_p0/decimalv3/test_decimalv3.groovy +++ b/regression-test/suites/datatype_p0/decimalv3/test_decimalv3.groovy @@ -28,6 +28,21 @@ suite("test_decimalv3") { qt_decimalv3 "select * from test5_v" qt_decimalv3 "select cast(a as decimalv3(12,10)) * cast(b as decimalv3(18,10)) from test5" + sql "drop table if exists test_decimal256;" + sql """ create table test_decimal256(k1 decimal(76, 6), v1 decimal(76, 6)) + DUPLICATE KEY(`k1`, `v1`) + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + properties("replication_num" = "1"); """ + sql """insert into test_decimal256 values(1, 9999999999999999999999999999999999999999999999999999999999999999999999.999999), + (2, 4999999999999999999999999999999999999999999999999999999999999999999999.999999);""" + qt_decimalv3_0 "select * from test_decimal256 order by k1, v1; " + qt_decimalv3_1 "select * from test_decimal256 where v1 = 9999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + qt_decimalv3_2 "select * from test_decimal256 where v1 != 9999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + qt_decimalv3_3 "select * from test_decimal256 where v1 > 4999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + qt_decimalv3_4 "select * from test_decimal256 where v1 >= 4999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + qt_decimalv3_5 "select * from test_decimal256 where v1 < 9999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + qt_decimalv3_6 "select * from test_decimal256 where v1 <= 9999999999999999999999999999999999999999999999999999999999999999999999.999999 order by k1, v1; " + sql "set experimental_enable_nereids_planner =false;" qt_aEb_test1 "select 0e0;" qt_aEb_test2 "select 1e-1"