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

Sergey Nuyanzin updated CALCITE-7575:
-------------------------------------
    Description: 
probably the reason is that in parser there is a separate Arg0 and other args

example of query
{code:sql}
SELECT * FROM TABLE(SIMILARLITY(
        TABLE emp PARTITION BY deptno,
        TABLE emp PARTITION BY deptno))
{code}
 

is rewritten to 
{code:sql}
SELECT * FROM TABLE(SIMILARLITY(
        (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
`EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`,
         (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
`EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`))
{code}
and parser fails to parse it

There is no such issue with PTF with only one {{TABLE}} arg

  was:
probably the reason is that in parser there is a separate Arg0 and other args

example of query
{code:sql}

SELECT * FROM TABLE(SIMILARLITY(
        TABLE emp PARTITION BY deptno,
        TABLE emp PARTITION BY deptno))
{code} 

is rewritten to 
{code:sql}

SELECT * FROM TABLE(SIMILARLITY(
        (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
`EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`,
         (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
`EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`))
{code}
and parser fails to parse it


> Parser can not parse unparsed polymorphic table functions with several table 
> args
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7575
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7575
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: core
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>
> probably the reason is that in parser there is a separate Arg0 and other args
> example of query
> {code:sql}
> SELECT * FROM TABLE(SIMILARLITY(
>         TABLE emp PARTITION BY deptno,
>         TABLE emp PARTITION BY deptno))
> {code}
>  
> is rewritten to 
> {code:sql}
> SELECT * FROM TABLE(SIMILARLITY(
>         (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
> `EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
> FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`,
>          (SELECT `EMP`.`EMPNO`, `EMP`.`ENAME`, `EMP`.`JOB`, `EMP`.`MGR`, 
> `EMP`.`HIREDATE`, `EMP`.`SAL`, `EMP`.`COMM`, `EMP`.`DEPTNO`, `EMP`.`SLACKER` 
> FROM `CATALOG`.`SALES`.`EMP` AS `EMP`) PARTITION BY `DEPTNO`))
> {code}
> and parser fails to parse it
> There is no such issue with PTF with only one {{TABLE}} arg



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

Reply via email to