This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 8f914aa864 [feature](Nereids) support 'timestamp' type constructor
(#15095)
8f914aa864 is described below
commit 8f914aa8647c650dc477b88f56886f0c3fe427b1
Author: mch_ucchi <[email protected]>
AuthorDate: Fri Dec 16 03:20:56 2022 +0800
[feature](Nereids) support 'timestamp' type constructor (#15095)
sql like: select timestamp '2022-01-01 01:00:00' + interval '2' hours;
---
.../doris/nereids/parser/LogicalPlanBuilder.java | 1 +
.../data/nereids_syntax_p0/timestamp.out | 7 +++++
.../suites/nereids_syntax_p0/timestamp.groovy | 35 ++++++++++++++++++++++
3 files changed, 43 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 340962fbfa..39546a55eb 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -783,6 +783,7 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
case "DATE":
return new DateLiteral(value);
case "DATETIME":
+ case "TIMESTAMP":
return new DateTimeLiteral(value);
default:
throw new ParseException("Unsupported data type : " + type,
ctx);
diff --git a/regression-test/data/nereids_syntax_p0/timestamp.out
b/regression-test/data/nereids_syntax_p0/timestamp.out
new file mode 100644
index 0000000000..a405549cad
--- /dev/null
+++ b/regression-test/data/nereids_syntax_p0/timestamp.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !select_1 --
+22
+
+-- !select_2 --
+2012-08-10T00:00 2012-08-09T06:00 2012-11-30T01:00
2012-08-06T00:00 2012-08-06T20:00 2012-09-30T01:00
+
diff --git a/regression-test/suites/nereids_syntax_p0/timestamp.groovy
b/regression-test/suites/nereids_syntax_p0/timestamp.groovy
new file mode 100644
index 0000000000..baa03b395f
--- /dev/null
+++ b/regression-test/suites/nereids_syntax_p0/timestamp.groovy
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("timestamp") {
+ sql 'set enable_nereids_planner=true'
+ sql 'set enable_vectorized_engine=true'
+ sql 'set enable_fallback_to_original_planner=false'
+
+ qt_select_1 '''
+ SELECT extract(day from TIMESTAMP '2001-08-22 03:04:05.321')
+ '''
+
+ qt_select_2 '''
+ SELECT date '2012-08-08' + interval '2' day,
+ timestamp '2012-08-08 01:00' + interval '29' hour,
+ timestamp '2012-10-31 01:00' + interval '1' month,
+ date '2012-08-08' - interval '2' day,
+ timestamp '2012-08-08 01:00' - interval '29' hour,
+ timestamp '2012-10-31 01:00' - interval '1' month
+ '''
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]