mihaibudiu commented on code in PR #4378:
URL: https://github.com/apache/calcite/pull/4378#discussion_r2101369404
##########
core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml:
##########
@@ -5007,6 +5007,30 @@ LogicalProject(ENAME=[$cor0.ENAME])
}), 0)])
LogicalProject(DEPTNO=[$7], ENAME=[$1])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase
name="testMultipleCorrelatedSubQueriesInSelectReferencingDifferentTablesInFrom">
Review Comment:
I thought `$cor` variables are introduced by Correlate nodes...
I guess they can also be introduced by `$SCALAR_QUERY` nodes?
Since the same name may be reused, I wonder whether there can arise
ambiguity when the correlated queries are actually nested.
##########
core/src/test/resources/sql/scalar.iq:
##########
@@ -301,4 +301,21 @@ from (values (1), (3)) t1(id);
!ok
+# Several scalar sub-queries reference different tables in FROM list
+select
+ (select ename from emp where empno = empnos.empno) as emp_name,
+ (select dname from dept where deptno = deptnos.deptno) as dept_name
+ from (values (7369), (7499)) as empnos(empno), (values (10), (20)) as
deptnos(deptno) order by 1, 2;
++----------+------------+
+| EMP_NAME | DEPT_NAME |
++----------+------------+
+| ALLEN | ACCOUNTING |
+| ALLEN | RESEARCH |
+| SMITH | ACCOUNTING |
+| SMITH | RESEARCH |
++----------+------------+
+(4 rows)
Review Comment:
I would add this as a comment to the iq file
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]