Skip to content

Commit

Permalink
regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Oct 7, 2023
1 parent 0b2e400 commit 96cfc81
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions be/src/runtime/raw_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions regression-test/data/datatype_p0/decimalv3/test_decimalv3.out
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions regression-test/suites/datatype_p0/decimalv3/test_decimalv3.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 96cfc81

Please sign in to comment.