I made this question on [Stackoverflow][1] but I'm cross posting here.
Are double quoted identifiers allowed in Flink SQL? [Calcite documentation says to use double quoted identifiers](https://calcite.apache.org/docs/reference.html#identifiers) but they don't seem to work (see below). On the other hand I just found > Identifiers follow SQL requirements which means that they can be escaped with a backtick character (`). on the [Table API & SQL > Concepts & Common API > Expanding Table identifiers][2] So I guess this means that [Flink SQL][3] is not really just Calcite SQL plus extras, as I assumed. --- When I tried the following in Flink I got an `SQL parse failed . Encountered "\"" at line 1 ,column 21.` complaining about the `"` (double quote) CREATE TABLE table1("ts" TIMESTAMP) WITH(...) The full exception is org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "\"" at line 1, column 21. Was expecting one of: "CONSTRAINT" ... "PRIMARY" ... "UNIQUE" ... "WATERMARK" ... <BRACKET_QUOTED_IDENTIFIER> ... <QUOTED_IDENTIFIER> ... <BACK_QUOTED_IDENTIFIER> ... <HYPHENATED_IDENTIFIER> ... <IDENTIFIER> ... <UNICODE_QUOTED_IDENTIFIER> ... at org.apache.flink.table.planner.calcite.CalciteParser.parse(CalciteParser.java:56) at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:76) at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:658) at com.rubenlaguna.BatchJobTest.testBatchJob(BatchJobTest.java:22) ..... [1]: https://stackoverflow.com/q/64588892/90580 [2]: https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/common.html#expanding-table-identifiers [3]: https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/sql/index.html -- /Rubén |
Yes, Flink SQL use the back quote ` as the quote character, for your SQL, it should be: CREATE TABLE table1(`ts` TIMESTAMP) WITH(...) Ruben Laguna <[hidden email]> 于2020年10月29日周四 下午6:32写道: I made this question on [Stackoverflow][1] but I'm cross posting here. |
Free forum by Nabble | Edit this page |