[ 
https://issues.apache.org/jira/browse/CALCITE-7312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Nuyanzin resolved CALCITE-7312.
--------------------------------------
    Fix Version/s: 1.42.0
       Resolution: Fixed

> Alias is not auto generated for LATERAL TABLE 
> ----------------------------------------------
>
>                 Key: CALCITE-7312
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7312
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> CALCITE-7217 fixed losing {{LATERAL}} while validation, however it seems it 
> missed the case if alias is not specified, for instance
> {code:sql}
> select * from emp, lateral table(ramp(emp.deptno)), dept
> {code}
> then validation will rewrite query to 
> {code:sql}
> SELECT SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
> `EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER`, 
> `EXPR$0`.`I`, `DEPT`.`DEPTNO` AS `DEPTNO0`, `DEPT`.`NAME`
> FROM `CATALOG`.`SALES`.`EMP` AS `EMP`,
> LATERAL TABLE(RAMP(`EMP`.`DEPTNO`))
> `CATALOG`.`SALES`.`DEPT` AS `DEPT`
> {code}
> thus it uses generated alias in projection however it doesn't add it to 
> {{LATERAL TABLE}} in {{FROM}}
> so it should be
> {code:sql}
> SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
> `EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER`, 
> `EXPR$0`.`I`, `DEPT`.`DEPTNO` AS `DEPTNO0`, `DEPT`.`NAME`
> FROM `CATALOG`.`SALES`.`EMP` AS `EMP`,
> LATERAL TABLE(RAMP(`EMP`.`DEPTNO`)) AS `EXPR$0`,
> `CATALOG`.`SALES`.`DEPT` AS `DEPT`
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to