[
https://issues.apache.org/jira/browse/CALCITE-3603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16997796#comment-16997796
]
Kevin Zhang commented on CALCITE-3603:
--------------------------------------
hi [~julianhyde], "LATERAL" is the operator name of SqlLateralOperator and it's
written out in all conditions when calling unparse currently, but when dealing
with SqlSnapshot, it should have other treatment.
> 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
>
> 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)