If I remember correctly, the rule pushes the Sort through the Join (if 
possible), but it also preserves the Sort on top of the Join to ensure 
correctness.

-Jesús


On 9/6/18, 9:57 AM, "Julian Hyde" <jh...@apache.org> wrote:

    Yes, it depends very much on the operator. Some examples:
    Merge join typically requires inputs to be sorted, and preserves that 
order. (But some outer joins may throw in null values out of order.)
    Map join typically preserves the order of the probing side, not the build 
side.
    Hash join typically destroys the order of both sides.
    Use the rule with caution.
    
    Julian
    
    
    > On Sep 6, 2018, at 9:33 AM, Stamatis Zampetakis <zabe...@gmail.com> wrote:
    > 
    > Hello,
    > 
    > I noticed that there is a Calcite rule (i.e., SortJoinTransposeRule) that
    > pushes a LogicalSort past a LogicalJoin if the join is either left outer 
or
    > right outer.
    > 
    > Who guarantees that the left and right outer joins are preserving the 
order
    > of the inputs?
    > Does the SQL standard requires that these types of joins are order
    > preserving?
    > 
    > Since we are working with logical operators, I would tend to think that we
    > cannot assume anything about the physical equivalent.
    > 
    > Best,
    > Stamatis
    
    

Reply via email to