The performance of our queries are dependent on our ability to push the
filter and sort into the RPC layer. Today the planner's
SortJoinTransposeRule
<https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/SortJoinTransposeRule.java>
pushes the sort through the join for LEFT OUTER and RIGHT OUTER  joins. The
logic comment states the following
    // 1) If join is not a left or right outer, we bail out
    // 2) If sort is not a trivial order-by, and if there is
    // any sort column that is not part of the input where the
    // sort is pushed, we bail out
    // 3) If sort has an offset, and if the non-preserved side
    // of the join is not count-preserving against the join
    // condition, we bail out

I am wondering if we can actually push the sort down through the INNER JOIN
if all the sort conditions are on one side of the join.

SELECT b.title, b.published_date, b.sales
FROM Book b
INNER JOIN Author a ON b.author = a.id
ORDER BY b.published_date, b.sales, b.title

Reply via email to