Skip to content

Commit

Permalink
[Impro](regression-test) More test cases for function round (apache#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh authored Sep 25, 2023
1 parent c9ef5ef commit cdc8189
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;"

Expand Down

0 comments on commit cdc8189

Please sign in to comment.