silundong commented on code in PR #4997:
URL: https://github.com/apache/calcite/pull/4997#discussion_r3370529524
##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -8168,6 +8168,578 @@ SELECT deptno FROM dept WHERE 1000.00 >
!ok
+# [CALCITE-7584] RelDecorrelator produces incorrect results for correlated
LATERAL sub-queries with window functions
+# Correlated LATERAL sub-query with a window expression.
+# The equality predicate between the inner and outer query must remain applied
+# after decorrelation.
+SELECT e.ename, d.deptno, d.m
+FROM emp e
+JOIN LATERAL (
+ SELECT d.deptno,
+ MAX(d.deptno + e.empno) OVER (PARTITION BY e.deptno) AS m
+ FROM dept d
+ WHERE e.deptno = d.deptno
+) d ON TRUE
+ORDER BY e.empno;
+!if (use_old_decorr) {
Review Comment:
Hi, I think any execution result test (!ok) in sub-query.iq should not be
guarded by `!if (use_old_decorr)` at this point, because these tests can also
verify the correctness of the new decorrelator. If a specific test case still
has an issue in the new decorrelator, while the old decorrelator already has a
fix or is being fixed, then `!if (use_old_decorr)` can be added for that case
temporarily and removed once the new decorrelator is fixed.
--
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]