# Golden test output of ABTPlanGeneration/LowerMergeJoinNode

==== VARIATION: Lower merge join with one projection (collation=Ascending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   Collation
|   |       Ascending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[4] mj 
    [asc] left [s2] [] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s4] [] 
        [3] project [s4 = getField(s3, "id")] 
        [2] scan s3 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with one projection (collation=Descending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   Collation
|   |       Descending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[4] mj 
    [desc] left [s2] [] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s4] [] 
        [3] project [s4 = getField(s3, "id")] 
        [2] scan s3 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with two projections (collation=Ascending, Ascending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   |       proj2 = proj3
|   |   Collation
|   |       Ascending
|   |       Ascending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] mj 
    [asc, asc] left [s2, s3] [] 
        [2] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5, s6] [] 
        [5] project [s6 = getField(s4, "city")] 
        [4] project [s5 = getField(s4, "id")] 
        [3] scan s4 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with two projections (collation=Ascending, Descending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   |       proj2 = proj3
|   |   Collation
|   |       Ascending
|   |       Descending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] mj 
    [asc, desc] left [s2, s3] [] 
        [2] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5, s6] [] 
        [5] project [s6 = getField(s4, "city")] 
        [4] project [s5 = getField(s4, "id")] 
        [3] scan s4 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with required projection (collation=Ascending) ====
-- INPUT:
Filter []
|   BinaryOp [FillEmpty]
|   |   Const [false]
|   BinaryOp [Eq]
|   |   Const ["NYC"]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [proj3]
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   Collation
|   |       Ascending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[9] filter {((getField(s6, "a") == "NYC") ?: false)} 
[8] mj 
    [asc] left [s2] [s3] 
        [3] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5] [s6] 
        [7] project [s6 = getField(s4, "city")] 
        [5] project [s5 = getField(s4, "id")] 
        [4] scan s4 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with two projections (collation=Descending, Ascending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   |       proj2 = proj3
|   |   Collation
|   |       Descending
|   |       Ascending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] mj 
    [desc, asc] left [s2, s3] [] 
        [2] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5, s6] [] 
        [5] project [s6 = getField(s4, "city")] 
        [4] project [s5 = getField(s4, "id")] 
        [3] scan s4 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with two projections (collation=Descending, Descending) ====
-- INPUT:
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   |       proj2 = proj3
|   |   Collation
|   |       Descending
|   |       Descending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] mj 
    [desc, desc] left [s2, s3] [] 
        [2] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5, s6] [] 
        [5] project [s6 = getField(s4, "city")] 
        [4] project [s5 = getField(s4, "id")] 
        [3] scan s4 none none none none none [] @"<collUUID>" true false 


==== VARIATION: Lower merge join with required projection (collation=Descending) ====
-- INPUT:
Filter []
|   BinaryOp [FillEmpty]
|   |   Const [false]
|   BinaryOp [Eq]
|   |   Const ["NYC"]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [proj3]
MergeJoin []
|   |   |   Condition
|   |   |       proj0 = proj1
|   |   Collation
|   |       Descending
|   Evaluation [{proj3}]
|   |   FunctionCall [getField]
|   |   |   Const ["city"]
|   |   Variable [scan1]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["id"]
|   |   Variable [scan1]
|   PhysicalScan [{'<root>': scan1}, otherColl]
Evaluation [{proj2}]
|   FunctionCall [getField]
|   |   Const ["city"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["other_id"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[9] filter {((getField(s6, "a") == "NYC") ?: false)} 
[8] mj 
    [desc] left [s2] [s3] 
        [3] project [s3 = getField(s1, "city")] 
        [1] project [s2 = getField(s1, "other_id")] 
        [0] scan s1 none none none none none [] @"<collUUID>" true false 
    right [s5] [s6] 
        [7] project [s6 = getField(s4, "city")] 
        [5] project [s5 = getField(s4, "id")] 
        [4] scan s4 none none none none none [] @"<collUUID>" true false 

