Skip to content

Commit

Permalink
fix: sort result of sqlness case decimal_ops (#2867)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored Dec 4, 2023
1 parent dac7a41 commit 5f5dbe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INSERT INTO decimals VALUES ('0.1',1000), ('0.2',2000);

Affected Rows: 2

-- SQLNESS SORT 3 1
SELECT * FROM decimals;

+------+---------------------+
Expand Down Expand Up @@ -36,6 +37,7 @@ SELECT * FROM decimals WHERE d = '0.1'::DECIMAL(3,2);
+------+---------------------+

-- greater than equals
-- SQLNESS SORT 3 1
SELECT * FROM decimals WHERE d >= '0.1'::DECIMAL(3,2);

+------+---------------------+
Expand Down Expand Up @@ -407,6 +409,7 @@ INSERT INTO tmp_table VALUES (1, 1000), (2, 2000), (3, 3000);

Affected Rows: 3

-- SQLNESS SORT 3 1
SELECT * FROM tmp_table;

+---+---------------------+
Expand All @@ -417,13 +420,14 @@ SELECT * FROM tmp_table;
| 3 | 1970-01-01T00:00:03 |
+---+---------------------+

-- SQLNESS SORT 3 1
SELECT * FROM tmp_table JOIN decimals ON decimals.ts = tmp_table.ts;

+---+---------------------+------+---------------------+
| i | ts | d | ts |
+---+---------------------+------+---------------------+
| 2 | 1970-01-01T00:00:02 | 0.20 | 1970-01-01T00:00:02 |
| 1 | 1970-01-01T00:00:01 | 0.10 | 1970-01-01T00:00:01 |
| 2 | 1970-01-01T00:00:02 | 0.20 | 1970-01-01T00:00:02 |
+---+---------------------+------+---------------------+

DROP TABLE decimals;
Expand Down
4 changes: 4 additions & 0 deletions tests/cases/standalone/common/types/decimal/decimal_ops.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CREATE TABLE decimals(d DECIMAL(3, 2), ts timestamp time index);

INSERT INTO decimals VALUES ('0.1',1000), ('0.2',2000);

-- SQLNESS SORT 3 1
SELECT * FROM decimals;

-- ORDER BY
Expand All @@ -16,6 +17,7 @@ SELECT * FROM decimals WHERE d = '0.1'::DECIMAL(3,2);

-- greater than equals

-- SQLNESS SORT 3 1
SELECT * FROM decimals WHERE d >= '0.1'::DECIMAL(3,2);

-- what about if we use different decimal scales?
Expand Down Expand Up @@ -194,8 +196,10 @@ CREATE TABLE tmp_table(i INTEGER, ts timestamp time index);

INSERT INTO tmp_table VALUES (1, 1000), (2, 2000), (3, 3000);

-- SQLNESS SORT 3 1
SELECT * FROM tmp_table;

-- SQLNESS SORT 3 1
SELECT * FROM tmp_table JOIN decimals ON decimals.ts = tmp_table.ts;

DROP TABLE decimals;
Expand Down

0 comments on commit 5f5dbe0

Please sign in to comment.