[Impro](regression-test) More test cases for function round (#24791)

This commit is contained in:
zhiqqqq
2023-09-25 10:39:45 +08:00
committed by GitHub
parent c9ef5ef2b1
commit cdc8189697
2 changed files with 29 additions and 0 deletions

View File

@ -11,6 +11,30 @@
-- !select --
10.12
-- !select --
0.0 0.0
0.5 0.0
1.0 1.0
1.5 2.0
2.0 2.0
2.5 2.0
3.0 3.0
3.5 4.0
4.0 4.0
4.5 4.0
-- !select --
0.0 0.0
0.5 1.0
1.0 1.0
1.5 2.0
2.0 2.0
2.5 3.0
3.0 3.0
3.5 4.0
4.0 4.0
4.5 5.0
-- !truncate --
1 1989 1001 123.1 0.1 6.3
2 1986 1001 1243.5 20.2 789.2

View File

@ -21,6 +21,11 @@
qt_select "SELECT round_bankers(10.12345)"
qt_select "SELECT round_bankers(10.12345, 2)"
// test tie case 1: float, banker's rounding
qt_select "SELECT number*10/100 AS x, ROUND(number * 10 / 100) from NUMBERS('number'=50) where number % 5 = 0 ORDER BY x;"
// test tie case 2: decimal, rounded up when tie
qt_select "SELECT number*10/100 AS x, ROUND(CAST(number * 10 AS DECIMALV3(10,2)) / 100) from NUMBERS('number'=50) where number % 5 = 0 ORDER BY x;"
def tableTest = "test_query_db.test"
qt_truncate "select truncate(k1, 1), truncate(k2, 1), truncate(k3, 1), truncate(k5, 1), truncate(k8, 1), truncate(k9, 1) from ${tableTest} order by 1;"