# Golden test output of ABTPlanGeneration/LowerSortedMergeNode

==== VARIATION: one source sorted on `a` Ascending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Ascending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4] [asc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Ascending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7] [asc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5] [s5] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Ascending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16] [asc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5] [s5] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8] [s8] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11] [s11] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14] [s14] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: one source sorted on `a` Ascending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Ascending
|   |       proj1: Ascending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4, s5] [asc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Ascending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Ascending
|   |   |       proj1: Ascending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7, s8] [asc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Ascending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Ascending
|   |   |   |   |   |       proj1: Ascending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16, s17] [asc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8, s9] [s8, s9] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11, s12] [s11, s12] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14, s15] [s14, s15] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: one source sorted on `a` Ascending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Ascending
|   |       proj1: Descending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4, s5] [asc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Ascending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Ascending
|   |   |       proj1: Descending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7, s8] [asc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Ascending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Ascending
|   |   |   |   |   |       proj1: Descending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16, s17] [asc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8, s9] [s8, s9] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11, s12] [s11, s12] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14, s15] [s14, s15] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: one source sorted on `a` Descending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Descending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4] [desc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Descending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Descending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7] [desc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5] [s5] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Descending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Descending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16] [desc] [
    [s2] [s2] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5] [s5] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8] [s8] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11] [s11] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14] [s14] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: one source sorted on `a` Descending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Descending
|   |       proj1: Ascending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4, s5] [desc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Descending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Descending
|   |   |       proj1: Ascending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7, s8] [desc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Descending and `b` Ascending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Descending
|   |   |   |   |   |       proj1: Ascending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16, s17] [desc, asc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8, s9] [s8, s9] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11, s12] [s11, s12] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14, s15] [s14, s15] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: one source sorted on `a` Descending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   collation: 
|   |       proj0: Descending
|   |       proj1: Descending
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[3] smerge [s4, s5] [desc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: two sources sorted on `a` Descending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   |   collation: 
|   |   |       proj0: Descending
|   |   |       proj1: Descending
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[6] smerge [s7, s8] [desc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 

==== VARIATION: five sources sorted on `a` Descending and `b` Descending ====
-- INPUT:
SortedMerge []
|   |   |   |   |   |   collation: 
|   |   |   |   |   |       proj0: Descending
|   |   |   |   |   |       proj1: Descending
|   |   |   |   Evaluation [{proj1}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["b"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   Evaluation [{proj0}]
|   |   |   |   |   FunctionCall [getField]
|   |   |   |   |   |   Const ["a"]
|   |   |   |   |   Variable [scan0]
|   |   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   |   Evaluation [{proj1}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["b"]
|   |   |   |   Variable [scan0]
|   |   |   Evaluation [{proj0}]
|   |   |   |   FunctionCall [getField]
|   |   |   |   |   Const ["a"]
|   |   |   |   Variable [scan0]
|   |   |   PhysicalScan [{'<root>': scan0}, collName]
|   |   Evaluation [{proj1}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["b"]
|   |   |   Variable [scan0]
|   |   Evaluation [{proj0}]
|   |   |   FunctionCall [getField]
|   |   |   |   Const ["a"]
|   |   |   Variable [scan0]
|   |   PhysicalScan [{'<root>': scan0}, collName]
|   Evaluation [{proj1}]
|   |   FunctionCall [getField]
|   |   |   Const ["b"]
|   |   Variable [scan0]
|   Evaluation [{proj0}]
|   |   FunctionCall [getField]
|   |   |   Const ["a"]
|   |   Variable [scan0]
|   PhysicalScan [{'<root>': scan0}, collName]
Evaluation [{proj1}]
|   FunctionCall [getField]
|   |   Const ["b"]
|   Variable [scan0]
Evaluation [{proj0}]
|   FunctionCall [getField]
|   |   Const ["a"]
|   Variable [scan0]
PhysicalScan [{'<root>': scan0}, collName]

-- OUTPUT:
[15] smerge [s16, s17] [desc, desc] [
    [s2, s3] [s2, s3] [1] project [s2 = getField(s1, "a"), s3 = getField(s1, "b")] 
    [0] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s5, s6] [s5, s6] [4] project [s5 = getField(s4, "a"), s6 = getField(s4, "b")] 
    [3] scan s4 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s8, s9] [s8, s9] [7] project [s8 = getField(s7, "a"), s9 = getField(s7, "b")] 
    [6] scan s7 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s11, s12] [s11, s12] [10] project [s11 = getField(s10, "a"), s12 = getField(s10, "b")] 
    [9] scan s10 none none none none none none none lowPriority [] @"<collUUID>" true false , 
    [s14, s15] [s14, s15] [13] project [s14 = getField(s13, "a"), s15 = getField(s13, "b")] 
    [12] scan s13 none none none none none none none lowPriority [] @"<collUUID>" true false 
] 
