From 9531469660a895827b5023c2c945c55ce7259409 Mon Sep 17 00:00:00 2001 From: Wei <15172118655@163.com> Date: Tue, 12 Dec 2023 20:45:38 +0800 Subject: [PATCH] fix: `date` - `interval` sqlness (#2912) fix: date - interval can work --- .../common/types/interval/interval.result | 22 +++++++++++++++++-- .../common/types/interval/interval.sql | 3 +-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/cases/standalone/common/types/interval/interval.result b/tests/cases/standalone/common/types/interval/interval.result index 90d1d318fe69..5cce116faf18 100644 --- a/tests/cases/standalone/common/types/interval/interval.result +++ b/tests/cases/standalone/common/types/interval/interval.result @@ -202,8 +202,26 @@ SELECT DATE '2000-10-30' + interval_value from intervals; +-----------------------------------------------+ -- DATE - INTERVAL --- Run failed in distributed mode, but passed in standalone mode: --- SELECT DATE '2000-10-30' - interval_value from intervals; +SELECT DATE '2000-10-30' - interval_value from intervals; + ++-----------------------------------------------+ +| Utf8("2000-10-30") - intervals.interval_value | ++-----------------------------------------------+ +| 1999-10-30 | +| 1999-10-30 | +| 1998-08-30 | +| 1997-10-30 | +| 1996-10-30 | +| 1995-10-30 | +| 1994-10-30 | +| 1993-10-30 | +| 1992-10-30 | +| 1991-10-21 | +| 1990-10-30 | +| 1989-10-19 | +| 1988-10-18 | ++-----------------------------------------------+ + -- INTERVAL + TIMESTAMP CONSTANT SELECT TIMESTAMP '1992-09-20 11:30:00.123456' + interval_value as new_value from intervals; diff --git a/tests/cases/standalone/common/types/interval/interval.sql b/tests/cases/standalone/common/types/interval/interval.sql index e1bb6dcc34e9..690abab1c548 100644 --- a/tests/cases/standalone/common/types/interval/interval.sql +++ b/tests/cases/standalone/common/types/interval/interval.sql @@ -58,8 +58,7 @@ SELECT ts - interval_value as new_value from intervals; SELECT DATE '2000-10-30' + interval_value from intervals; -- DATE - INTERVAL --- Run failed in distributed mode, but passed in standalone mode: --- SELECT DATE '2000-10-30' - interval_value from intervals; +SELECT DATE '2000-10-30' - interval_value from intervals; -- INTERVAL + TIMESTAMP CONSTANT SELECT TIMESTAMP '1992-09-20 11:30:00.123456' + interval_value as new_value from intervals;