mihaibudiu commented on code in PR #4515:
URL: https://github.com/apache/calcite/pull/4515#discussion_r2310712628
##########
core/src/main/java/org/apache/calcite/rel/rules/SortJoinTransposeRule.java:
##########
@@ -174,6 +177,24 @@ public SortJoinTransposeRule(Class<? extends Sort>
sortClass,
call.transformTo(sortCopy);
}
+ /**
+ * Returns the fetch value for the inner sort when pushing sort past join.
+ * The value is outer sort's offset + fetch.
+ *
+ * @param sort the outer sort
+ * @param rexBuilder RexBuilder to create literals
+ * @return fetch for inner sort
+ */
+ private static @Nullable RexNode calculateInnerSortFetch(Sort sort,
RexBuilder rexBuilder) {
+ if (sort.fetch == null) {
+ return null;
+ }
+ final int outerFetch = RexLiteral.intValue(sort.fetch);
Review Comment:
This doesn't mean the previous way of doing things is right...
You can write a test with a very large limit to see what happens. In the
best case you get an exception. In the worst case you get silent wraparound.
--
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]