开发者社区> 问答> 正文

Flink SQL Api不支持TIMESTAMP(p) WITH TIME ZONE 类型的列吗?

你好, 我最近在使用Flink 1.13.1版本的SQL Api时,遇到了不支持TIMESTAMP(p) WITH TIME ZONE 类型数据的问题: 使用SQL: CREATE TABLE source ( ctimestamp TIMESTAMP(6) WITH TIME ZONE) WITH ('connector' = 'print’) 创建表,报错: Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered "TIME" at line 1, column 55. Was expecting: "LOCAL" ...

at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.convertException(FlinkSqlParserImpl.java:450) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.normalizeException(FlinkSqlParserImpl.java:213) at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:140) at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:155) at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:180) at org.apache.flink.table.planner.parse.CalciteParser.parse(CalciteParser.java:54) ... 30 more Caused by: org.apache.flink.sql.parser.impl.ParseException: Encountered "TIME" at line 1, column 55. Was expecting: "LOCAL" ...

at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.generateParseException(FlinkSqlParserImpl.java:39782) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.jj_consume_token(FlinkSqlParserImpl.java:39593) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.TimeZoneOpt(FlinkSqlParserImpl.java:25946) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.DateTimeTypeName(FlinkSqlParserImpl.java:25892) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlTypeName(FlinkSqlParserImpl.java:25168) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.TypeName(FlinkSqlParserImpl.java:24787) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.ExtendedDataType(FlinkSqlParserImpl.java:4990) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.TypedColumn(FlinkSqlParserImpl.java:4866) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.TableColumn(FlinkSqlParserImpl.java:4491) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreateTable(FlinkSqlParserImpl.java:5197) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreateExtended(FlinkSqlParserImpl.java:6233) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreate(FlinkSqlParserImpl.java:20934) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlStmt(FlinkSqlParserImpl.java:3415) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlStmtEof(FlinkSqlParserImpl.java:3918) at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.parseSqlStmtEof(FlinkSqlParserImpl.java:261) at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:153) ... 32 more

而使用SQL: CREATE TABLE source ( ctimestamp TIMESTAMP(6) WITH LOCAL TIME ZONE) WITH ('connector' = 'print’) 创建表则不会有问题,请问Flink SQL Api当前是否支持TIMESTAMP(p) WITH TIME ZONE 类型数据或者有相关Bug。*来自志愿者整理的flink邮件归档

展开
收起
EXCEED 2021-12-02 15:56:40 1446 0
1 条回答
写回答
取消 提交回答
  • 目前 timestamp 相关类型只支持普通的 timestamp 还有 timestamp with local time zone 这两种。如果是有把 Fri Mar 26 12:27:05 IST 2021 这种带时区的 string 转成 timestamp 的需求,建议使用 date_format 函数。*来自志愿者整理的FLINK邮件归档

    2021-12-02 16:12:39
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
SQL Server在电子商务中的应用与实践 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载