Hi All,
在用FlinkSqlParserImpl.FACTORY解析Flink DML SQL时,发现解析Join with Temporal Table语法,会自动加上LATERAL关键字,如下所示 LEFT JOIN side_room FOR SYSTEM_TIME AS OF a1.proctime as a2 ON a1.rowkey_room = a2.rowkey 解析后变成如下: LEFT JOIN LATERAL `side_room` FOR SYSTEM_TIME AS OF `a1`.`proctime` AS `a2` ON `a1`.`rowkey_room` = `a2`.`rowkey` 此SQL语法在Flink SQL中执行会报错如下: Caused by: org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "`side_room`" at line 7, column 19. Was expecting one of: "TABLE" ... "(" ... 我的SqlParser.Config类定义如下: private final SqlParser.Config config = SqlParser.configBuilder() .setParserFactory(FlinkSqlParserImpl.FACTORY) .setQuoting(Quoting.BACK_TICK) .setUnquotedCasing(Casing.UNCHANGED) .setQuotedCasing(Casing.UNCHANGED) .setCaseSensitive(true) .build(); 不知道这个地方为什么会出现这种情况,或者是我这边使用方法不对? |
Administrator
|
我记得这个好像是个 bug,已经在 calcite 修复了。 你用的是哪个版本的 flink?
Best, Jark On Thu, 14 May 2020 at 15:30, Senior.Hu <[hidden email]> wrote: > Hi All, > 在用FlinkSqlParserImpl.FACTORY解析Flink DML SQL时,发现解析Join with Temporal > Table语法,会自动加上LATERAL关键字,如下所示 > LEFT JOIN > side_room FOR SYSTEM_TIME AS OF a1.proctime as > a2 > ON > a1.rowkey_room = a2.rowkey > 解析后变成如下: > LEFT JOIN LATERAL `side_room` FOR SYSTEM_TIME AS OF > `a1`.`proctime` AS `a2` ON `a1`.`rowkey_room` = `a2`.`rowkey` > > 此SQL语法在Flink SQL中执行会报错如下: > Caused by: org.apache.flink.table.api.SqlParserException: SQL parse > failed. Encountered "`side_room`" at line 7, column 19. > Was expecting one of: > "TABLE" ... > "(" ... > > 我的SqlParser.Config类定义如下: > private final SqlParser.Config config = SqlParser.configBuilder() > > .setParserFactory(FlinkSqlParserImpl.FACTORY) > .setQuoting(Quoting.BACK_TICK) > > .setUnquotedCasing(Casing.UNCHANGED) > > .setQuotedCasing(Casing.UNCHANGED) > .setCaseSensitive(true) > .build(); > > 不知道这个地方为什么会出现这种情况,或者是我这边使用方法不对? |
1.10
------------------ 原始邮件 ------------------ 发件人: "Jark Wu"<[hidden email]>; 发送时间: 2020年5月17日(星期天) 中午11:42 收件人: "user-zh"<[hidden email]>; 主题: Re: Flink SQL解析问题 我记得这个好像是个 bug,已经在 calcite 修复了。 你用的是哪个版本的 flink? Best, Jark On Thu, 14 May 2020 at 15:30, Senior.Hu <[hidden email]> wrote: > Hi All, > &nbsp; 在用FlinkSqlParserImpl.FACTORY解析Flink DML SQL时,发现解析Join with Temporal > Table语法,会自动加上LATERAL关键字,如下所示 > &nbsp; LEFT JOIN > &nbsp; &nbsp; &nbsp; &nbsp; side_room FOR SYSTEM_TIME AS OF a1.proctime as > a2 > &nbsp; &nbsp; ON > &nbsp; &nbsp; &nbsp; &nbsp; a1.rowkey_room = a2.rowkey > &nbsp; 解析后变成如下: > &nbsp;&nbsp;LEFT JOIN LATERAL `side_room` FOR SYSTEM_TIME AS OF > `a1`.`proctime` AS `a2` ON `a1`.`rowkey_room` = `a2`.`rowkey` > &nbsp;&nbsp; > &nbsp; 此SQL语法在Flink SQL中执行会报错如下: > &nbsp; Caused by: org.apache.flink.table.api.SqlParserException: SQL parse > failed. Encountered "`side_room`" at line 7, column 19. > &nbsp; Was expecting one of: > &nbsp; &nbsp; "TABLE" ... > &nbsp; &nbsp; "(" ... > &nbsp;&nbsp; > &nbsp;我的SqlParser.Config类定义如下: > &nbsp;private final SqlParser.Config config = SqlParser.configBuilder() > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .setParserFactory(FlinkSqlParserImpl.FACTORY) > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .setQuoting(Quoting.BACK_TICK) > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .setUnquotedCasing(Casing.UNCHANGED) > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .setQuotedCasing(Casing.UNCHANGED) > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .setCaseSensitive(true) > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .build(); > &nbsp;&nbsp; > &nbsp; 不知道这个地方为什么会出现这种情况,或者是我这边使用方法不对? |
Administrator
|
Hi,
https://issues.apache.org/jira/browse/CALCITE-3603 这个是 Calcite 修复的链接,在 Calcite-1.22 版本中修复了。 Flink 是在1.11 版本中升级到了 Calcite-1.22: https://issues.apache.org/jira/browse/FLINK-14338 所以可能你需要等待下 Flink 1.11, 或者可以拿 release-1.11 分支自己先编译一个。 Best, Jark On Mon, 18 May 2020 at 17:01, Senior.Hu <[hidden email]> wrote: > 1.10 > > > > > ------------------ 原始邮件 ------------------ > 发件人: "Jark Wu"<[hidden email]>; > 发送时间: 2020年5月17日(星期天) 中午11:42 > 收件人: "user-zh"<[hidden email]>; > > 主题: Re: Flink SQL解析问题 > > > > 我记得这个好像是个 bug,已经在 calcite 修复了。 你用的是哪个版本的 flink? > > Best, > Jark > > On Thu, 14 May 2020 at 15:30, Senior.Hu <[hidden email]> wrote: > > > Hi All, > > &nbsp; 在用FlinkSqlParserImpl.FACTORY解析Flink DML SQL时,发现解析Join with > Temporal > > Table语法,会自动加上LATERAL关键字,如下所示 > > &nbsp; LEFT JOIN > > &nbsp; &nbsp; &nbsp; &nbsp; side_room FOR SYSTEM_TIME > AS OF a1.proctime as > > a2 > > &nbsp; &nbsp; ON > > &nbsp; &nbsp; &nbsp; &nbsp; a1.rowkey_room = a2.rowkey > > &nbsp; 解析后变成如下: > > &nbsp;&nbsp;LEFT JOIN LATERAL `side_room` FOR SYSTEM_TIME AS > OF > > `a1`.`proctime` AS `a2` ON `a1`.`rowkey_room` = `a2`.`rowkey` > > &nbsp;&nbsp; > > &nbsp; 此SQL语法在Flink SQL中执行会报错如下: > > &nbsp; Caused by: org.apache.flink.table.api.SqlParserException: > SQL parse > > failed. Encountered "`side_room`" at line 7, column 19. > > &nbsp; Was expecting one of: > > &nbsp; &nbsp; "TABLE" ... > > &nbsp; &nbsp; "(" ... > > &nbsp;&nbsp; > > &nbsp;我的SqlParser.Config类定义如下: > > &nbsp;private final SqlParser.Config config = > SqlParser.configBuilder() > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > > .setParserFactory(FlinkSqlParserImpl.FACTORY) > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .setQuoting(Quoting.BACK_TICK) > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > > .setUnquotedCasing(Casing.UNCHANGED) > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > > .setQuotedCasing(Casing.UNCHANGED) > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .setCaseSensitive(true) > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; > .build(); > > &nbsp;&nbsp; > > &nbsp; 不知道这个地方为什么会出现这种情况,或者是我这边使用方法不对? |
Free forum by Nabble | Edit this page |