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

Jin Xing updated CALCITE-3658:
------------------------------
    Description: 
UPDATE clause like below

{code:java}
update emp set empno = empno + 1
{code}

will be converted to 

{code:java}
LogicalTableModify(table=[[CATALOG, SALES, EMP]], operation=[UPDATE], 
updateColumnList=[[EMPNO]], sourceExpressionList=[[+($cor0.EMPNO, 1)]], 
flattened=[true])
  LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], 
SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EXPR$0=[+($0, 1)])
    LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}

However the correlated variables $cor0.EMPNO should not exist in 
*sourceExpressionList*.
It also brings trouble when convert TableModify back to Sql string.

  was:
UPDATE clause like below

{code:java}
update emp set empno = empno + 1
{code}

will be converted to 

{code:java}
LogicalTableModify(table=[[CATALOG, SALES, EMP]], operation=[UPDATE], 
updateColumnList=[[EMPNO]], sourceExpressionList=[[+($cor0.EMPNO, 1)]], 
flattened=[true])
  LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], 
SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EXPR$0=[+($0, 1)])
    LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}

However the correlated variables should not exist in *sourceExpressionList*.
It also brings trouble when convert TableModify back to Sql string.


> TableModify of Update contains correlated variable by mistake.
> --------------------------------------------------------------
>
>                 Key: CALCITE-3658
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3658
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Jin Xing
>            Priority: Major
>
> UPDATE clause like below
> {code:java}
> update emp set empno = empno + 1
> {code}
> will be converted to 
> {code:java}
> LogicalTableModify(table=[[CATALOG, SALES, EMP]], operation=[UPDATE], 
> updateColumnList=[[EMPNO]], sourceExpressionList=[[+($cor0.EMPNO, 1)]], 
> flattened=[true])
>   LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], 
> SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EXPR$0=[+($0, 1)])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> However the correlated variables $cor0.EMPNO should not exist in 
> *sourceExpressionList*.
> It also brings trouble when convert TableModify back to Sql string.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to