xuzifu666 commented on code in PR #5354:
URL: https://github.com/apache/calcite/pull/5354#discussion_r4369902491


##########
core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml:
##########
@@ -7140,6 +7140,53 @@ LogicalSort(offset=[?0])
 LogicalSort(offset=[+(1, ABS(-2))])
   LogicalProject(EMPNO=[$0])
     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+]]>
+    </Resource>
+  </TestCase>
+  <TestCase name="testOnClauseCorrelatedScalarSubquery">
+    <Resource name="sql">
+      <![CDATA[select *
+from dept
+left join bonus on bonus.job = (
+  select emp.job
+  from emp
+  where emp.deptno = dept.deptno
+)]]>
+    </Resource>
+    <Resource name="plan">
+      <![CDATA[
+LogicalProject(DEPTNO=[$0], NAME=[$1], ENAME=[$2], JOB=[$3], SAL=[$4], 
COMM=[$5])
+  LogicalJoin(condition=[=($0, $6)], joinType=[left])
+    LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
+    LogicalJoin(condition=[=($1, $5)], joinType=[inner])
+      LogicalTableScan(table=[[CATALOG, SALES, BONUS]])
+      LogicalAggregate(group=[{0}], agg#0=[SINGLE_VALUE($1)])
+        LogicalProject(DEPTNO=[$7], JOB=[$2])
+          LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+]]>
+    </Resource>
+  </TestCase>
+  <TestCase name="testOnClauseCorrelatedScalarSubqueryInner">
+    <Resource name="sql">
+      <![CDATA[select *
+from dept
+join bonus on bonus.job = (
+  select emp.job
+  from emp
+  where emp.deptno = dept.deptno
+)]]>
+    </Resource>
+    <Resource name="plan">
+      <![CDATA[
+LogicalProject(DEPTNO=[$0], NAME=[$1], ENAME=[$2], JOB=[$3], SAL=[$4], 
COMM=[$5])

Review Comment:
   You're right, I had validated in 
https://onecompiler.com/postgresql/4577bv8cm which result is the same with 
postgresql.



-- 
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]

Reply via email to