File tree 3 files changed +60
-1
lines changed
java/org/apache/calcite/test
core/src/main/codegen/templates
3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,20 @@ public static void main(String[] args) throws Exception {
124
124
typeFactory .createSqlType (
125
125
SqlTypeName .TIMESTAMP_WITH_LOCAL_TIME_ZONE )))
126
126
.connect ();
127
+ case "scott-mysql" :
128
+ return CalciteAssert .that ()
129
+ .with (CalciteAssert .SchemaSpec .SCOTT )
130
+ .with (CalciteConnectionProperty .FUN , "standard,mysql" )
131
+ .with (CalciteConnectionProperty .LEX , Lex .MYSQL )
132
+ .with (CalciteConnectionProperty .PARSER_FACTORY ,
133
+ BabelDdlExecutor .class .getName () + "#PARSER_FACTORY" )
134
+ .with (CalciteConnectionProperty .CONFORMANCE ,
135
+ SqlConformanceEnum .BABEL )
136
+ .with (CalciteConnectionProperty .LENIENT_OPERATOR_LOOKUP , true )
137
+ .with (
138
+ ConnectionFactories .addType ("DATETIME" , typeFactory ->
139
+ typeFactory .createSqlType (SqlTypeName .TIMESTAMP )))
140
+ .connect ();
127
141
case "scott-postgresql" :
128
142
return CalciteAssert .that ()
129
143
.with (CalciteAssert .SchemaSpec .SCOTT )
Original file line number Diff line number Diff line change
1
+ # mysql.iq - Babel test for MySQL dialect of SQL
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to you under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ !use scott-mysql
19
+ !set outputformat mysql
20
+
21
+ SELECT cast(cast(DATETIME '1000-01-01 00:00:00' as DATETIME) as DATETIME);
22
+ +---------------------+
23
+ | EXPR$0 |
24
+ +---------------------+
25
+ | 1000-01-01 00:00:00 |
26
+ +---------------------+
27
+ (1 row)
28
+
29
+ !ok
30
+
31
+ SELECT cast(cast(DATETIME '9999-12-31 23:59:59' as DATETIME) as DATETIME);
32
+ +---------------------+
33
+ | EXPR$0 |
34
+ +---------------------+
35
+ | 9999-12-31 23:59:59 |
36
+ +---------------------+
37
+ (1 row)
38
+
39
+ !ok
Original file line number Diff line number Diff line change @@ -6154,7 +6154,7 @@ SqlTypeNameSpec CharacterTypeName(Span s) :
6154
6154
}
6155
6155
6156
6156
/**
6157
- * Parse datetime types: date, time, timestamp.
6157
+ * Parse datetime types: date, time, timestamp, datetime .
6158
6158
*/
6159
6159
SqlTypeNameSpec DateTimeTypeName() :
6160
6160
{
@@ -6182,6 +6182,12 @@ SqlTypeNameSpec DateTimeTypeName() :
6182
6182
{
6183
6183
return new SqlBasicTypeNameSpec(typeName, precision, s.end(this));
6184
6184
}
6185
+ |
6186
+ <DATETIME> { s = span(); }
6187
+ precision = PrecisionOpt()
6188
+ {
6189
+ return new SqlBasicTypeNameSpec(SqlTypeName.TIMESTAMP, precision, s.end(this));
6190
+ }
6185
6191
}
6186
6192
6187
6193
// Parse an optional data type precision, default is -1.
You can’t perform that action at this time.
0 commit comments