diff --git a/core/src/main/java/org/apache/calcite/util/Bug.java b/core/src/main/java/org/apache/calcite/util/Bug.java
index 90dce754cbaa..c9a57d4d4af6 100644
--- a/core/src/main/java/org/apache/calcite/util/Bug.java
+++ b/core/src/main/java/org/apache/calcite/util/Bug.java
@@ -108,12 +108,6 @@ public abstract class Bug {
*/
public static final boolean FRG254_FIXED = false;
- /**
- * Whether issue
- * FRG-282: Support precision in TIME and TIMESTAMP data types is fixed.
- */
- public static final boolean FRG282_FIXED = false;
-
/**
* Whether issue
* FRG-296: SUBSTRING(string FROM regexp FOR regexp) is fixed.
@@ -211,6 +205,14 @@ public abstract class Bug {
*/
public static final boolean TODO_FIXED = false;
+ /** Whether
+ * [CALCITE-6282]
+ * Avatica ignores time precision when returning TIME results is fixed.
+ * This should be removed once the bug is fixed in Avatica, and
+ * Calcite switches to the most recent version of Avatica.
+ * This is expected to be fixed in Avatica 1.25.0. */
+ public static final boolean CALCITE_6282_FIXED = false;
+
/**
* Use this method to flag temporary code.
*
diff --git a/core/src/test/resources/sql/misc.iq b/core/src/test/resources/sql/misc.iq
index 5999222b455f..fd60c24693a5 100644
--- a/core/src/test/resources/sql/misc.iq
+++ b/core/src/test/resources/sql/misc.iq
@@ -2136,6 +2136,7 @@ EnumerableAggregate(group=[{}], C=[COUNT()])
EnumerableValues(tuples=[[]])
!plan
+!if (fixed.calcite6828) {
# [CALCITE-1659] Simplifying CAST('YYYY-MM-DD hh:mm:ss.SSS' as TIMESTAMP)
# should round the sub-second fraction
select TIMESTAMP '2016-02-26 19:06:00.123456789',
@@ -2146,17 +2147,20 @@ select TIMESTAMP '2016-02-26 19:06:00.123456789',
CAST('2016-02-26 19:06:00.123' as TIMESTAMP(3)),
CAST('2016-02-26 19:06:00.123' as TIMESTAMP(6)),
CAST('2016-02-26 19:06:00.123' as TIMESTAMP(9));
-+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+
-| EXPR$0 | EXPR$1 | EXPR$2 | EXPR$3 | EXPR$4 | EXPR$5 | EXPR$6 | EXPR$7 |
-+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+
-| 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 |
-+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+
++-------------------------+---------------------+---------------------+-----------------------+------------------------+-------------------------+-------------------------+-------------------------+
+| EXPR$0 | EXPR$1 | EXPR$2 | EXPR$3 | EXPR$4 | EXPR$5 | EXPR$6 | EXPR$7 |
++-------------------------+---------------------+---------------------+-----------------------+------------------------+-------------------------+-------------------------+-------------------------+
+| 2016-02-26 19:06:00.123 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 2016-02-26 19:06:00.1 | 2016-02-26 19:06:00.12 | 2016-02-26 19:06:00.123 | 2016-02-26 19:06:00.123 | 2016-02-26 19:06:00.123 |
++-------------------------+---------------------+---------------------+-----------------------+------------------------+-------------------------+-------------------------+-------------------------+
(1 row)
!ok
EnumerableValues(tuples=[[{ 2016-02-26 19:06:00.123, 2016-02-26 19:06:00, 2016-02-26 19:06:00, 2016-02-26 19:06:00.1, 2016-02-26 19:06:00.12, 2016-02-26 19:06:00.123, 2016-02-26 19:06:00.123, 2016-02-26 19:06:00.123 }]])
!plan
+!}
+
+!if (fixed.calcite6828) {
# [CALCITE-1664] CAST('' as TIMESTAMP) adds part of sub-second fraction to the value
select
TIMESTAMP '2016-02-26 19:06:00.12345678',
@@ -2164,15 +2168,16 @@ select
TIMESTAMPDIFF(SECOND,
TIMESTAMP '2016-02-26 19:06:00.123456789',
CAST('2016-02-26 19:06:00.123456789' as TIMESTAMP));
-+---------------------+---------------------+--------+
-| EXPR$0 | EXPR$1 | EXPR$2 |
-+---------------------+---------------------+--------+
-| 2016-02-26 19:06:00 | 2016-02-26 19:06:00 | 0 |
-+---------------------+---------------------+--------+
++-------------------------+---------------------+--------+
+| EXPR$0 | EXPR$1 | EXPR$2 |
++-------------------------+---------------------+--------+
+| 2016-02-26 19:06:00.123 | 2016-02-26 19:06:00 | 0 |
++-------------------------+---------------------+--------+
(1 row)
!ok
+!}
# TIMESTAMPDIFF with 'flag' literal as time unit argument
SELECT TIMESTAMPDIFF(quarter, TIMESTAMP '2008-12-25', TIMESTAMP '2008-09-25');
+--------+
diff --git a/core/src/test/resources/sql/operator.iq b/core/src/test/resources/sql/operator.iq
index 9fe31a46329b..278010727cf8 100644
--- a/core/src/test/resources/sql/operator.iq
+++ b/core/src/test/resources/sql/operator.iq
@@ -221,6 +221,7 @@ order by 1,2;
!ok
+!if (fixed.calcite6828) {
# FLOOR and CEIL of TIME
select v,
case when b then 'ceil' else 'floor' end as op,
@@ -235,16 +236,17 @@ select v,
from (values (time '12:34:56.7')) as t(v),
(values false, true) as u(b)
order by 1,2;
-+----------+-------+----------+----------+----------+----------+----------+----------+----------+----------+
-| V | OP | Y | Q | M | W | D | H | MI | S |
-+----------+-------+----------+----------+----------+----------+----------+----------+----------+----------+
-| 12:34:56 | ceil | 12:34:57 | 12:34:56 | 12:34:56 | 12:34:56 | 12:34:56 | 13:00:00 | 12:35:00 | 12:34:57 |
-| 12:34:56 | floor | 12:34:56 | 12:34:56 | 12:34:56 | 12:34:56 | 12:34:56 | 12:00:00 | 12:34:00 | 12:34:56 |
-+----------+-------+----------+----------+----------+----------+----------+----------+----------+----------+
++------------+-------+------------+------------+------------+------------+------------+------------+------------+------------+
+| V | OP | Y | Q | M | W | D | H | MI | S |
++------------+-------+------------+------------+------------+------------+------------+------------+------------+------------+
+| 12:34:56.7 | ceil | 12:34:57.0 | 12:34:56.7 | 12:34:56.7 | 12:34:56.7 | 12:34:56.7 | 13:00:00.0 | 12:35:00.0 | 12:34:57.0 |
+| 12:34:56.7 | floor | 12:34:56.6 | 12:34:56.6 | 12:34:56.6 | 12:34:56.6 | 12:34:56.7 | 12:00:00.0 | 12:34:00.0 | 12:34:56.0 |
++------------+-------+------------+------------+------------+------------+------------+------------+------------+------------+
(2 rows)
-
!ok
+!}
+
select "T"."X"[1] as x1 from (VALUES (ROW(ROW(3, 7), ROW(4, 8)))) as T(x, y);
X1 INTEGER(10) NOT NULL
diff --git a/core/src/test/resources/sql/stream.iq b/core/src/test/resources/sql/stream.iq
index 365994e0e1a0..f0ef3504f56c 100644
--- a/core/src/test/resources/sql/stream.iq
+++ b/core/src/test/resources/sql/stream.iq
@@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+!if (fixed.calcite6282) {
!use orinoco
!set outputformat mysql
SELECT * FROM TABLE(
@@ -22,76 +23,76 @@ SELECT * FROM TABLE(
DATA => TABLE ORDERS,
TIMECOL => DESCRIPTOR(ROWTIME),
SIZE => INTERVAL '1' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:16:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 10:59:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:11:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
SELECT * FROM TABLE(TUMBLE(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '1' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:16:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 10:59:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:11:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
SELECT * FROM TABLE(TUMBLE((SELECT * FROM ORDERS), DESCRIPTOR(ROWTIME), INTERVAL '1' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:16:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 10:59:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:11:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
SELECT * FROM TABLE(TUMBLE((SELECT * FROM ORDERS), DESCRIPTOR(ROWTIME), INTERVAL '10' MINUTE, INTERVAL '3' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:13:00 | 2015-02-15 10:23:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:23:00 | 2015-02-15 10:33:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:23:00 | 2015-02-15 10:33:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:53:00 | 2015-02-15 11:03:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:03:00 | 2015-02-15 11:13:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:13:00.000 | 2015-02-15 10:23:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:53:00.000 | 2015-02-15 11:03:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:03:00.000 | 2015-02-15 11:13:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '5' MINUTE, INTERVAL '10' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00 | 2015-02-15 10:20:00 |
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00 | 2015-02-15 11:00:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00 | 2015-02-15 11:05:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00 | 2015-02-15 11:15:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:20:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 |
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(10 rows)
!ok
@@ -102,72 +103,72 @@ SELECT * FROM TABLE(
TIMECOL => DESCRIPTOR(ROWTIME),
SLIDE => INTERVAL '5' MINUTE,
SIZE => INTERVAL '10' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00 | 2015-02-15 10:20:00 |
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00 | 2015-02-15 11:00:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00 | 2015-02-15 11:05:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00 | 2015-02-15 11:15:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:20:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 |
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(10 rows)
!ok
SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '5' MINUTE, INTERVAL '10' MINUTE, INTERVAL '2' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:07:00 | 2015-02-15 10:17:00 |
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:12:00 | 2015-02-15 10:22:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:17:00 | 2015-02-15 10:27:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:22:00 | 2015-02-15 10:32:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:17:00 | 2015-02-15 10:27:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:22:00 | 2015-02-15 10:32:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:52:00 | 2015-02-15 11:02:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:57:00 | 2015-02-15 11:07:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:02:00 | 2015-02-15 11:12:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:07:00 | 2015-02-15 11:17:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:07:00.000 | 2015-02-15 10:17:00.000 |
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:12:00.000 | 2015-02-15 10:22:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:52:00.000 | 2015-02-15 11:02:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:57:00.000 | 2015-02-15 11:07:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:02:00.000 | 2015-02-15 11:12:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:07:00.000 | 2015-02-15 11:17:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(10 rows)
!ok
SELECT * FROM TABLE(HOP((SELECT * FROM ORDERS), DESCRIPTOR(ROWTIME), INTERVAL '5' MINUTE, INTERVAL '10' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00 | 2015-02-15 10:20:00 |
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00 | 2015-02-15 10:25:00 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00 | 2015-02-15 10:30:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00 | 2015-02-15 11:00:00 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00 | 2015-02-15 11:05:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00 | 2015-02-15 11:15:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00 | 2015-02-15 11:20:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 |
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(10 rows)
!ok
SELECT * FROM TABLE(SESSION(TABLE ORDERS, DESCRIPTOR(ROWTIME), DESCRIPTOR(PRODUCT), INTERVAL '20' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:35:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15 | 2015-02-15 10:44:15 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45 | 2015-02-15 10:44:45 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:35:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15.000 | 2015-02-15 10:44:15.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45.000 | 2015-02-15 10:44:45.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
@@ -178,29 +179,32 @@ SELECT * FROM TABLE(
TIMECOL => DESCRIPTOR(ROWTIME),
KEY => DESCRIPTOR(PRODUCT),
SIZE => INTERVAL '20' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:35:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15 | 2015-02-15 10:44:15 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45 | 2015-02-15 10:44:45 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:35:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15.000 | 2015-02-15 10:44:15.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45.000 | 2015-02-15 10:44:45.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
SELECT * FROM TABLE(SESSION((SELECT * FROM ORDERS), DESCRIPTOR(ROWTIME), DESCRIPTOR(PRODUCT), INTERVAL '20' MINUTE));
-+---------------------+----+---------+-------+---------------------+---------------------+
-| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
-+---------------------+----+---------+-------+---------------------+---------------------+
-| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00 | 2015-02-15 10:35:00 |
-| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15 | 2015-02-15 10:44:15 |
-| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45 | 2015-02-15 10:44:45 |
-| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00 | 2015-02-15 11:30:00 |
-+---------------------+----+---------+-------+---------------------+---------------------+
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| ROWTIME | ID | PRODUCT | UNITS | window_start | window_end |
++---------------------+----+---------+-------+-------------------------+-------------------------+
+| 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:35:00.000 |
+| 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:15.000 | 2015-02-15 10:44:15.000 |
+| 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:45.000 | 2015-02-15 10:44:45.000 |
+| 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
+| 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 11:30:00.000 |
++---------------------+----+---------+-------+-------------------------+-------------------------+
(5 rows)
!ok
+
+!}
+# End of fixed.calcite6282
diff --git a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
index 023de7c972d1..7c9fef60c0da 100644
--- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
+++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
@@ -211,19 +211,19 @@ public class SqlOperatorTest {
public static final boolean TODO = false;
/**
- * Regular expression for a SQL TIME(0) value.
+ * Regular expression for a SQL TIME(0/1) value.
*/
public static final Pattern TIME_PATTERN =
Pattern.compile(
- "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]");
+ "[0-9][0-9]:[0-9][0-9]:[0-9][0-9](.[0-9])?");
/**
- * Regular expression for a SQL TIMESTAMP(0) value.
+ * Regular expression for a SQL TIMESTAMP(0/1) value.
*/
public static final Pattern TIMESTAMP_PATTERN =
Pattern.compile(
"[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] "
- + "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]");
+ + "[0-9][0-9]:[0-9][0-9]:[0-9][0-9](.[0-9])?");
/**
* Regular expression for a SQL DATE value.
@@ -1167,7 +1167,7 @@ void testCastDateTime(CastType castType, SqlOperatorFixture f) {
"12:42:26", "TIME(0) NOT NULL");
}
- if (Bug.FRG282_FIXED) {
+ if (Bug.CALCITE_6282_FIXED) {
// test precision
f.checkScalar("cast(TIME '12:42:25.34' as TIME(2))",
"12:42:25.34", "TIME(2) NOT NULL");
@@ -1230,7 +1230,7 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {
f.checkScalar("cast('12:42:25.34' as TIME)",
"12:42:25", "TIME(0) NOT NULL");
- if (Bug.FRG282_FIXED) {
+ if (Bug.CALCITE_6282_FIXED) {
f.checkScalar("cast('12:42:25.34' as TIME(2))",
"12:42:25.34", "TIME(2) NOT NULL");
}
@@ -1270,12 +1270,10 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {
f.checkScalar("cast('2004-02-29' as TIMESTAMP)",
"2004-02-29 00:00:00", "TIMESTAMP(0) NOT NULL");
- if (Bug.FRG282_FIXED) {
+ if (Bug.CALCITE_6282_FIXED) {
f.checkScalar("cast('1945-02-24 12:42:25.34' as TIMESTAMP(2))",
"1945-02-24 12:42:25.34", "TIMESTAMP(2) NOT NULL");
- }
- // Remove the if condition and the else block once CALCITE-6053 is fixed
- if (TestUtil.AVATICA_VERSION.startsWith("1.0.0-dev-main")) {
+
if (castType == CastType.CAST) {
f.checkFails("cast('1945-2-2 12:2:5' as TIMESTAMP)",
"Invalid DATE value, '1945-2-2 12:2:5'", true);
@@ -1295,17 +1293,6 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {
f.checkNull("cast('1945-01-24 25:42:25.34' as TIMESTAMP)");
f.checkNull("cast('1945-1-24 12:23:34.454' as TIMESTAMP)");
}
- } else {
- f.checkScalar("cast('1945-2-2 12:2:5' as TIMESTAMP)",
- "1945-02-02 12:02:05", "TIMESTAMP(0) NOT NULL");
- f.checkScalar("cast('1241241' as TIMESTAMP)",
- "1241-01-01 00:00:00", "TIMESTAMP(0) NOT NULL");
- f.checkScalar("cast('1945-20-24 12:42:25.34' as TIMESTAMP)",
- "1946-08-26 12:42:25", "TIMESTAMP(0) NOT NULL");
- f.checkScalar("cast('1945-01-24 25:42:25.34' as TIMESTAMP)",
- "1945-01-25 01:42:25", "TIMESTAMP(0) NOT NULL");
- f.checkScalar("cast('1945-1-24 12:23:34.454' as TIMESTAMP)",
- "1945-01-24 12:23:34", "TIMESTAMP(0) NOT NULL");
}
if (castType == CastType.CAST) {
f.checkFails("cast('nottime' as TIMESTAMP)", BAD_DATETIME_MESSAGE, true);
@@ -11547,14 +11534,16 @@ private static void checkArrayConcatAggFuncFails(SqlOperatorFixture t) {
"(?s)Cannot apply 'FLOOR' to arguments .*", false);
f.checkScalar("floor(time '12:34:56' to minute)",
"12:34:00", "TIME(0) NOT NULL");
- f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to second)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to millisecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to microsecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to nanosecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
+ if (Bug.CALCITE_6282_FIXED) {
+ f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to second)",
+ "2015-02-19 12:34:56.00", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to millisecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to microsecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("floor(timestamp '2015-02-19 12:34:56.78' to nanosecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ }
f.checkScalar("floor(timestamp '2015-02-19 12:34:56' to minute)",
"2015-02-19 12:34:00", "TIMESTAMP(0) NOT NULL");
f.checkScalar("floor(timestamp '2015-02-19 12:34:56' to year)",
@@ -11592,16 +11581,18 @@ private static void checkArrayConcatAggFuncFails(SqlOperatorFixture t) {
"12:35:00", "TIME(0) NOT NULL");
f.checkScalar("ceil(time '12:59:56' to minute)",
"13:00:00", "TIME(0) NOT NULL");
- f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to second)",
- "2015-02-19 12:34:57", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to millisecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to microsecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to nanosecond)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
- f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.00' to second)",
- "2015-02-19 12:34:56", "TIMESTAMP(2) NOT NULL");
+ if (Bug.CALCITE_6282_FIXED) {
+ f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to second)",
+ "2015-02-19 12:34:57.00", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to millisecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to microsecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.78' to nanosecond)",
+ "2015-02-19 12:34:56.78", "TIMESTAMP(2) NOT NULL");
+ f.checkScalar("ceil(timestamp '2015-02-19 12:34:56.00' to second)",
+ "2015-02-19 12:34:56.00", "TIMESTAMP(2) NOT NULL");
+ }
f.checkScalar("ceil(timestamp '2015-02-19 12:34:56' to minute)",
"2015-02-19 12:35:00", "TIMESTAMP(0) NOT NULL");
f.checkScalar("ceil(timestamp '2015-02-19 12:34:56' to year)",
@@ -11734,26 +11725,30 @@ private static void checkArrayConcatAggFuncFails(SqlOperatorFixture t) {
@Test void testTimestampAdd() {
final SqlOperatorFixture f = fixture();
f.setFor(SqlStdOperatorTable.TIMESTAMP_ADD, VmName.EXPAND);
- MICROSECOND_VARIANTS.forEach(s ->
- f.checkScalar("timestampadd(" + s
- + ", 2000000, timestamp '2016-02-24 12:42:25')",
- "2016-02-24 12:42:27",
- "TIMESTAMP(3) NOT NULL"));
+ if (Bug.CALCITE_6282_FIXED) {
+ MICROSECOND_VARIANTS.forEach(s ->
+ f.checkScalar("timestampadd(" + s
+ + ", 2000000, timestamp '2016-02-24 12:42:25')",
+ "2016-02-24 12:42:27.000",
+ "TIMESTAMP(3) NOT NULL"));
+ }
SECOND_VARIANTS.forEach(s ->
f.checkScalar("timestampadd(" + s
+ ", 2, timestamp '2016-02-24 12:42:25')",
"2016-02-24 12:42:27",
"TIMESTAMP(0) NOT NULL"));
- NANOSECOND_VARIANTS.forEach(s ->
- f.checkScalar("timestampadd(" + s
- + ", 3000000000, timestamp '2016-02-24 12:42:25')",
- "2016-02-24 12:42:28",
- "TIMESTAMP(3) NOT NULL"));
- NANOSECOND_VARIANTS.forEach(s ->
- f.checkScalar("timestampadd(" + s
- + ", 2000000000, timestamp '2016-02-24 12:42:25')",
- "2016-02-24 12:42:27",
- "TIMESTAMP(3) NOT NULL"));
+ if (Bug.CALCITE_6282_FIXED) {
+ NANOSECOND_VARIANTS.forEach(s ->
+ f.checkScalar("timestampadd(" + s
+ + ", 3000000000, timestamp '2016-02-24 12:42:25')",
+ "2016-02-24 12:42:28.000",
+ "TIMESTAMP(3) NOT NULL"));
+ NANOSECOND_VARIANTS.forEach(s ->
+ f.checkScalar("timestampadd(" + s
+ + ", 2000000000, timestamp '2016-02-24 12:42:25')",
+ "2016-02-24 12:42:27.000",
+ "TIMESTAMP(3) NOT NULL"));
+ }
MINUTE_VARIANTS.forEach(s ->
f.checkScalar("timestampadd(" + s
+ ", 2, timestamp '2016-02-24 12:42:25')",