link版本:1.11.1
官网文档中定义如下:
<computed_column_definition>:
column_name AS computed_column_expression [COMMENT column_comment]
我看到官方文档中计算列是可以指定column_comment的,但我尝试了一下发现会报错
使用方式和报错信息如下:
create table t1(
data_time STRING,
row1_time AS to_timestamp(data_time) COMMENT 'test'
WATERMARK FOR row1_time AS row1_time - INTERVAL '5' SECOND
) with(...)
org.apache.flink.sql.parser.impl.ParseException: Encountered "COMMENT" at line 1, column 74.
Was expecting one of:
"FILTER" ...
"OVER" ...
"WITHIN" ...
")" ...
"," ...
"." ...
"NOT" ...
"IN" ...
"<" ...
"<=" ...
">" ...
">=" ...
"=" ...
"<>" ...
"!=" ...
"BETWEEN" ...
"LIKE" ...
"SIMILAR" ...
"+" ...
"-" ...
"*" ...
"/" ...
"%" ...
"||" ...
"AND" ...
"OR" ...
"IS" ...
"MEMBER" ...
"SUBMULTISET" ...
"CONTAINS" ...
"OVERLAPS" ...
"EQUALS" ...
"PRECEDES" ...
"SUCCEEDS" ...
"IMMEDIATELY" ...
"MULTISET" ...
"[" ...
"FORMAT" ...
"IGNORE" ...
"RESPECT" ...
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.generateParseException(F linkSqlParserImpl.java:36086)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.jj_consume_token(FlinkSq lParserImpl.java:35900)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreateTable(FlinkSqlP arserImpl.java:5271)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreateExtended(FlinkS qlParserImpl.java:6269)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlCreate(FlinkSqlParser Impl.java:19047)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlStmt(FlinkSqlParserIm pl.java:3308)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.SqlStmtList(FlinkSqlPars erImpl.java:2775)
at org.apache.flink.sql.parser.impl.FlinkSqlParserImpl.parseSqlStmtList(FlinkSq lParserImpl.java:252)
at org.apache.calcite.sql.parser.SqlParser.parseStmtList(SqlParser.java:201) *来自志愿者整理的flink邮件归档
这是个bug, 看起来是支持计算列时漏掉了comment的解析,我开了个issue去修复[1].
[1] https://issues.apache.org/jira/browse/FLINK-19092 https://issues.apache.org/jira/browse/FLINK-19092*来自志愿者整理的flink
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。