[ https://issues.apache.org/jira/browse/CALCITE-3603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16997908#comment-16997908 ]
Kevin Zhang commented on CALCITE-3603: -------------------------------------- Thanks [~danny0405], it helps. > SqlLateralOperator's unparse add additional keyword 'LATERAL' when the inner > operator is SqlSnapshot > ---------------------------------------------------------------------------------------------------- > > Key: CALCITE-3603 > URL: https://issues.apache.org/jira/browse/CALCITE-3603 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.21.0 > Reporter: Kevin Zhang > Priority: Minor > Labels: pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > When joining with a dimension table using the following sql > {code:sql} > SELECT > o.amout, o.currency, r.rate, o.amount * r.rate > FROM > Orders AS o > JOIN LatestRates FOR SYSTEM_TIME AS OF o.proctime AS r > ON r.currency = o.currency > {code} > the unparsed sql is: > {code:sql} > SELECT `o`.`amout`, `o`.`currency`, `r`.`rate`, `o`.`amount` * `r`.`rate` > FROM `Orders` AS `o` > INNER JOIN LATERAL `LatestRates` FOR SYSTEM_TIME AS OF `o`.`proctime` AS `r` > ON `r`.`currency` = `o`.`currency` > {code} > which has a syntax error because an additional "LATERAL" is added after > "JOIN". > The problem lies in SqlLateralOperator's unparse method, if the kind of the > first operand is SqlSnapshot, we should not write out the operator's name. -- This message was sent by Atlassian Jira (v8.3.4#803005)