[CALCITE-7584] RelDecorrelator produces incorrect results for correlated LATERAL sub-queries with window functions#4997
Conversation
| # 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 |
There was a problem hiding this comment.
cd476d3 to
ac8b355
Compare
| .with(CalciteAssert.Config.REGULAR) | ||
| .query(sql) | ||
| .returnsUnordered("name=Bill; deptno=10; M=190", | ||
| "name=Bill; deptno=30; M=190", |
There was a problem hiding this comment.
49d666d to
1621414
Compare
| * <p>3.3 Unnesting Rules | ||
| * (https://dl.gi.de/server/api/core/bitstreams/c1918e8c-6a87-4da2-930a-bfed289f2388/content) | ||
| */ | ||
| @Override public RexNode visitOver(RexOver over) { |
There was a problem hiding this comment.
This seems to conflict with #4998, so let's merge the other one first if it turns out to be right, so we can see the final shape of this function
There was a problem hiding this comment.
the two fixes are related but apply to different shuttles. This PR updates visitOver in DecorrelateRexShuttle, while #4998 updates visitOver in RemoveCorrelationRexShuttle.
I also verified that if RemoveCorrelationForScalarAggregateRule is disabled in removeCorrelationViaRule(), the #4998 fix does not seem to be needed. So #4998 appears to address the rule-based decorrelation path, whereas this PR addresses the DecorrelateRexShuttle path.
…ted LATERAL sub-queries with window functions
1621414 to
a21627d
Compare
|



CALCITE-7584