From 96a4215830911d99a9b4ebbf2f0fad8fd17122a4 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Mon, 4 Dec 2023 20:19:13 +0800 Subject: [PATCH] fix: sort result of sqlness case decimal_ops Signed-off-by: Ruihang Xia --- .../standalone/common/types/decimal/decimal_ops.result | 6 +++++- tests/cases/standalone/common/types/decimal/decimal_ops.sql | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/cases/standalone/common/types/decimal/decimal_ops.result b/tests/cases/standalone/common/types/decimal/decimal_ops.result index c1bc4a082eaa..967d7545db67 100644 --- a/tests/cases/standalone/common/types/decimal/decimal_ops.result +++ b/tests/cases/standalone/common/types/decimal/decimal_ops.result @@ -7,6 +7,7 @@ INSERT INTO decimals VALUES ('0.1',1000), ('0.2',2000); Affected Rows: 2 +-- SQLNESS SORT 3 1 SELECT * FROM decimals; +------+---------------------+ @@ -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); +------+---------------------+ @@ -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; +---+---------------------+ @@ -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; diff --git a/tests/cases/standalone/common/types/decimal/decimal_ops.sql b/tests/cases/standalone/common/types/decimal/decimal_ops.sql index b28e5748d528..e59a3cefcd80 100644 --- a/tests/cases/standalone/common/types/decimal/decimal_ops.sql +++ b/tests/cases/standalone/common/types/decimal/decimal_ops.sql @@ -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 @@ -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? @@ -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;