rubenada commented on code in PR #4515:
URL: https://github.com/apache/calcite/pull/4515#discussion_r2313502008
##########
core/src/test/resources/sql/planner.iq:
##########
@@ -351,4 +351,179 @@ FROM "scott"."EMP";
!ok
+# [CALCITE-4617] Wrong offset when SortJoinTransposeRule pushes a Sort with an
offset
+select d.deptno, empno from "scott"."DEPT" d
+right join "scott"."EMP" e using (deptno) limit 10 offset 2;
++--------+-------+
+| DEPTNO | EMPNO |
++--------+-------+
+| 10 | 7934 |
+| 20 | 7369 |
+| 20 | 7566 |
+| 20 | 7788 |
+| 20 | 7876 |
+| 20 | 7902 |
+| 30 | 7499 |
+| 30 | 7521 |
+| 30 | 7654 |
+| 30 | 7698 |
++--------+-------+
+(10 rows)
+
+!ok
+EnumerableCalc(expr#0..2=[{inputs}], proj#0..1=[{exprs}])
+ EnumerableLimit(offset=[2], fetch=[10])
+ EnumerableHashJoin(condition=[=($0, $2)], joinType=[right])
+ EnumerableCalc(expr#0..2=[{inputs}], DEPTNO=[$t0])
+ EnumerableTableScan(table=[[scott, DEPT]])
+ EnumerableCalc(expr#0..7=[{inputs}], EMPNO=[$t0], DEPTNO=[$t7])
Review Comment:
According to the rule's javadoc example, and the RelOptRuleTest's
testSortJoinTranspose6, shouldn't we have here on the RHS an
`EnumerableLimit(fetch=[12])` on top of the EMP table?
--
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]