Flink版本: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) |
Hi, sllence
这是个bug, 看起来是支持计算列时漏掉了comment的解析,我开了个issue去修复[1]. 祝好 Leonard [1] https://issues.apache.org/jira/browse/FLINK-19092 <https://issues.apache.org/jira/browse/FLINK-19092> > 在 2020年8月29日,13:37,<[hidden email]> <[hidden email]> 写道: > > Flink版本: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) > |
Free forum by Nabble | Edit this page |