exec-ddl
CREATE TABLE a (
    k INT PRIMARY KEY,
    i INT,
    f FLOAT,
    s STRING,
    j JSON,
    UNIQUE INDEX (s DESC, f) STORING (j)
)
----
TABLE a
 ├── k int not null
 ├── i int
 ├── f float
 ├── s string
 ├── j jsonb
 ├── INDEX primary
 │    └── k int not null
 └── INDEX secondary
      ├── s string desc
      ├── f float
      ├── k int not null (storing)
      └── j jsonb (storing)

exec-ddl
CREATE TABLE t.xy (x INT PRIMARY KEY, y INT)
----
TABLE xy
 ├── x int not null
 ├── y int
 └── INDEX primary
      └── x int not null

# --------------------------------------------------
# Use optsteps.
# --------------------------------------------------
optsteps
SELECT s FROM a INNER JOIN xy ON a.k=xy.x AND i+1=10
----
================================================================================
Initial expression
  Cost: 8836.67
================================================================================
  project
   ├── columns: s:4(string)
   └── inner-join
        ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
        ├── key: (1,6)
        ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (6)-->(7)
        ├── scan a
        │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
        │    ├── key: (1)
        │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
        ├── scan xy
        │    ├── columns: x:6(int!null) y:7(int)
        │    ├── key: (6)
        │    └── fd: (6)-->(7)
        └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
             └── (k = x) AND ((i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
NormalizeCmpPlusConst
  Cost: 8836.67
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
  -      ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
  +      ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
         ├── key: (1,6)
         ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (6)-->(7)
         ├── scan a
         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
         │    ├── key: (1)
         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
  -      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
  -           └── (k = x) AND ((i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
  +      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])]
  +           └── (k = x) AND (i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])]
================================================================================
FoldBinary
  Cost: 2236.67
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
         ├── key: (1,6)
  -      ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (6)-->(7)
  +      ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5), (6)-->(7)
         ├── scan a
         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
         │    ├── key: (1)
         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
  -      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])]
  -           └── (k = x) AND (i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])]
  +      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ]), fd=()-->(2)]
  +           └── (k = x) AND (i = 9) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ])]
================================================================================
SimplifyFilters
  Cost: 2170.20
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
  -      ├── key: (1,6)
  -      ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5), (6)-->(7)
  +      ├── key: (6)
  +      ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5), (6)-->(7), (1)==(6), (6)==(1)
         ├── scan a
         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
         │    ├── key: (1)
         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
  -      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ]), fd=()-->(2)]
  -           └── (k = x) AND (i = 9) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ])]
  +      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ]), fd=()-->(2), (1)==(6), (6)==(1)]
  +           ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
  +           └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
================================================================================
PushFilterIntoJoinLeft
  Cost: 2167.82
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5), (6)-->(7), (1)==(6), (6)==(1)
  -      ├── scan a
  -      │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  +      ├── select
  +      │    ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      │    ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5)
  +      │    ├── scan a
  +      │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  +      │    │    ├── key: (1)
  +      │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +      │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
  -      └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /6: (/NULL - ]), fd=()-->(2), (1)==(6), (6)==(1)]
  -           ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
  -           └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  +      └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
  +           └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
PruneJoinLeftCols
  Cost: 2167.92
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
  -      ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) x:6(int!null) y:7(int)
  +      ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null) y:7(int)
         ├── key: (6)
  -      ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5), (6)-->(7), (1)==(6), (6)==(1)
  -      ├── select
  -      │    ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
  +      ├── fd: ()-->(2), (1)-->(4), (6)-->(7), (1)==(6), (6)==(1)
  +      ├── project
  +      │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
  -      │    ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5)
  -      │    ├── scan a
  -      │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  -      │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  -      │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  +      │    ├── fd: ()-->(2), (1)-->(4)
  +      │    └── select
  +      │         ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
  +      │         ├── key: (1)
  +      │         ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5)
  +      │         ├── scan a
  +      │         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  +      │         │    ├── key: (1)
  +      │         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      │         └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +      │              └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
         └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
              └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
PruneSelectCols
  Cost: 2147.92
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null) y:7(int)
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (6)-->(7), (1)==(6), (6)==(1)
         ├── project
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    └── select
  -      │         ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
  +      │         ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │         ├── key: (1)
  -      │         ├── fd: ()-->(2), (1)-->(3-5), (3,4)~~>(1,5)
  +      │         ├── fd: ()-->(2), (1)-->(4)
         │         ├── scan a
  -      │         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  +      │         │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │         │    ├── key: (1)
  -      │         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      │         │    └── fd: (1)-->(2,4)
         │         └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │              └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
         └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
              └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
EliminateProject
  Cost: 2147.82
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null) y:7(int)
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (6)-->(7), (1)==(6), (6)==(1)
  -      ├── project
  +      ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  -      │    └── select
  -      │         ├── columns: k:1(int!null) i:2(int!null) s:4(string)
  -      │         ├── key: (1)
  -      │         ├── fd: ()-->(2), (1)-->(4)
  -      │         ├── scan a
  -      │         │    ├── columns: k:1(int!null) i:2(int) s:4(string)
  -      │         │    ├── key: (1)
  -      │         │    └── fd: (1)-->(2,4)
  -      │         └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      │              └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  +      │    ├── scan a
  +      │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
  +      │    │    ├── key: (1)
  +      │    │    └── fd: (1)-->(2,4)
  +      │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +      │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
         ├── scan xy
         │    ├── columns: x:6(int!null) y:7(int)
         │    ├── key: (6)
         │    └── fd: (6)-->(7)
         └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
              └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
PruneJoinRightCols
  Cost: 2137.82
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
  -      ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null) y:7(int)
  +      ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
         ├── key: (6)
  -      ├── fd: ()-->(2), (1)-->(4), (6)-->(7), (1)==(6), (6)==(1)
  +      ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
         ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    ├── scan a
         │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2,4)
         │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
         ├── scan xy
  -      │    ├── columns: x:6(int!null) y:7(int)
  -      │    ├── key: (6)
  -      │    └── fd: (6)-->(7)
  +      │    ├── columns: x:6(int!null)
  +      │    └── key: (6)
         └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
              └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateConstrainedScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
================================================================================
CommuteJoin
  Cost: 2132.88
================================================================================
   project
    ├── columns: s:4(string)
    └── inner-join
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
  +      ├── scan xy
  +      │    ├── columns: x:6(int!null)
  +      │    └── key: (6)
         ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    ├── scan a
         │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2,4)
         │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  -      ├── scan xy
  -      │    ├── columns: x:6(int!null)
  -      │    └── key: (6)
         └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
              └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
================================================================================
GenerateMergeJoins
  Cost: 2130.30
================================================================================
   project
    ├── columns: s:4(string)
  - └── inner-join
  + └── inner-join (merge)
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
  -      ├── scan xy
  -      │    ├── columns: x:6(int!null)
  -      │    └── key: (6)
         ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  +      │    ├── ordering: +1 opt(2)
         │    ├── scan a
         │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2,4)
  +      │    │    ├── fd: (1)-->(2,4)
  +      │    │    └── ordering: +1 opt(2)
         │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  -      └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)]
  -           └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])]
  +      ├── scan xy
  +      │    ├── columns: x:6(int!null)
  +      │    ├── key: (6)
  +      │    └── ordering: +6
  +      └── merge-on
  +           ├── left ordering: +1
  +           ├── right ordering: +6
  +           └── true [type=bool]
================================================================================
GenerateLookupJoins
  Cost: 1140.40
================================================================================
   project
    ├── columns: s:4(string)
  - └── inner-join (merge)
  + └── inner-join (lookup xy)
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
  +      ├── key columns: [1] = [6]
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
         ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  -      │    ├── ordering: +1 opt(2)
         │    ├── scan a
         │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │    │    ├── key: (1)
  -      │    │    ├── fd: (1)-->(2,4)
  -      │    │    └── ordering: +1 opt(2)
  +      │    │    └── fd: (1)-->(2,4)
         │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  -      ├── scan xy
  -      │    ├── columns: x:6(int!null)
  -      │    ├── key: (6)
  -      │    └── ordering: +6
  -      └── merge-on
  -           ├── left ordering: +1
  -           ├── right ordering: +6
  -           └── true [type=bool]
  +      └── true [type=bool]
--------------------------------------------------------------------------------
CommuteJoin (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateMergeJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: s:4(string)
  - └── inner-join (lookup xy)
  + └── inner-join (merge)
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
  -      ├── key columns: [1] = [6]
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
  +      ├── scan xy
  +      │    ├── columns: x:6(int!null)
  +      │    ├── key: (6)
  +      │    └── ordering: +6
         ├── select
         │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  +      │    ├── ordering: +1 opt(2)
         │    ├── scan a
         │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
         │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2,4)
  +      │    │    ├── fd: (1)-->(2,4)
  +      │    │    └── ordering: +1 opt(2)
         │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  -      └── true [type=bool]
  +      └── merge-on
  +           ├── left ordering: +6
  +           ├── right ordering: +1
  +           └── true [type=bool]
--------------------------------------------------------------------------------
GenerateLookupJoinsWithFilter (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: s:4(string)
  - └── inner-join (merge)
  + └── inner-join (lookup a)
         ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
  +      ├── key columns: [6] = [1]
         ├── key: (6)
         ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
         ├── scan xy
         │    ├── columns: x:6(int!null)
  -      │    ├── key: (6)
  -      │    └── ordering: +6
  -      ├── select
  -      │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
  -      │    ├── key: (1)
  -      │    ├── fd: ()-->(2), (1)-->(4)
  -      │    ├── ordering: +1 opt(2)
  -      │    ├── scan a
  -      │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
  -      │    │    ├── key: (1)
  -      │    │    ├── fd: (1)-->(2,4)
  -      │    │    └── ordering: +1 opt(2)
  -      │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
  -      └── merge-on
  -           ├── left ordering: +6
  -           ├── right ordering: +1
  -           └── true [type=bool]
  +      │    └── key: (6)
  +      └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +           └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
================================================================================
Final best expression
  Cost: 1140.40
================================================================================
  project
   ├── columns: s:4(string)
   └── inner-join (lookup xy)
        ├── columns: k:1(int!null) i:2(int!null) s:4(string) x:6(int!null)
        ├── key columns: [1] = [6]
        ├── key: (6)
        ├── fd: ()-->(2), (1)-->(4), (1)==(6), (6)==(1)
        ├── select
        │    ├── columns: k:1(int!null) i:2(int!null) s:4(string)
        │    ├── key: (1)
        │    ├── fd: ()-->(2), (1)-->(4)
        │    ├── scan a
        │    │    ├── columns: k:1(int!null) i:2(int) s:4(string)
        │    │    ├── key: (1)
        │    │    └── fd: (1)-->(2,4)
        │    └── filters [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
        │         └── i = 9 [type=bool, outer=(2), constraints=(/2: [/9 - /9]; tight)]
        └── true [type=bool]

# Exploration patterns with varying costs.
optsteps
SELECT s, k FROM a WHERE s='foo' AND f>100
----
================================================================================
Initial expression
  Cost: 1110.03
================================================================================
  project
   ├── columns: s:4(string!null) k:1(int!null)
   ├── key: (1)
   ├── fd: ()-->(4)
   └── select
        ├── columns: k:1(int!null) i:2(int) f:3(float!null) s:4(string!null) j:5(jsonb)
        ├── key: (1)
        ├── fd: ()-->(4), (1)-->(2,3,5), (3)-->(1,2,5)
        ├── scan a
        │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
        │    ├── key: (1)
        │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
        └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
             └── (s = 'foo') AND (f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)]
================================================================================
SimplifyFilters
  Cost: 1110.03
================================================================================
   project
    ├── columns: s:4(string!null) k:1(int!null)
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
         ├── columns: k:1(int!null) i:2(int) f:3(float!null) s:4(string!null) j:5(jsonb)
         ├── key: (1)
         ├── fd: ()-->(4), (1)-->(2,3,5), (3)-->(1,2,5)
         ├── scan a
         │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
         │    ├── key: (1)
         │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
  -           └── (s = 'foo') AND (f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)]
  +           ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)]
  +           └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
================================================================================
PruneSelectCols
  Cost: 1090.03
================================================================================
   project
    ├── columns: s:4(string!null) k:1(int!null)
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
  -      ├── columns: k:1(int!null) i:2(int) f:3(float!null) s:4(string!null) j:5(jsonb)
  +      ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
         ├── key: (1)
  -      ├── fd: ()-->(4), (1)-->(2,3,5), (3)-->(1,2,5)
  +      ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
         ├── scan a
  -      │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  +      │    ├── columns: k:1(int!null) f:3(float) s:4(string)
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      │    └── fd: (1)-->(3,4), (3,4)~~>(1)
         └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
              ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)]
              └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
================================================================================
GenerateIndexScans
  Cost: 1080.03
================================================================================
   project
    ├── columns: s:4(string!null) k:1(int!null)
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
         ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
         ├── key: (1)
         ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
  -      ├── scan a
  +      ├── scan a@secondary
         │    ├── columns: k:1(int!null) f:3(float) s:4(string)
         │    ├── key: (1)
         │    └── fd: (1)-->(3,4), (3,4)~~>(1)
         └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
              ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)]
              └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
================================================================================
GenerateConstrainedScans
  Cost: 3.63
================================================================================
   project
    ├── columns: s:4(string!null) k:1(int!null)
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
         ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
         ├── key: (1)
         ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
         ├── scan a@secondary
  -      │    ├── columns: k:1(int!null) f:3(float) s:4(string)
  +      │    ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
  +      │    ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
         │    ├── key: (1)
  -      │    └── fd: (1)-->(3,4), (3,4)~~>(1)
  -      └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
  -           ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)]
  -           └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
  +      │    └── fd: ()-->(4), (1)-->(3), (3)-->(1)
  +      └── filters [type=bool]
  +           ├── true [type=bool]
  +           └── true [type=bool]
================================================================================
SimplifyFilters
  Cost: 3.60
================================================================================
   project
    ├── columns: s:4(string!null) k:1(int!null)
    ├── key: (1)
    ├── fd: ()-->(4)
  - └── select
  + └── scan a@secondary
         ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
  +      ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
         ├── key: (1)
  -      ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
  -      ├── scan a@secondary
  -      │    ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
  -      │    ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
  -      │    ├── key: (1)
  -      │    └── fd: ()-->(4), (1)-->(3), (3)-->(1)
  -      └── filters [type=bool]
  -           ├── true [type=bool]
  -           └── true [type=bool]
  +      └── fd: ()-->(4), (1)-->(3), (3)-->(1)
================================================================================
Final best expression
  Cost: 3.60
================================================================================
  project
   ├── columns: s:4(string!null) k:1(int!null)
   ├── key: (1)
   ├── fd: ()-->(4)
   └── scan a@secondary
        ├── columns: k:1(int!null) f:3(float!null) s:4(string!null)
        ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
        ├── key: (1)
        └── fd: ()-->(4), (1)-->(3), (3)-->(1)

# Decorrelation pattern.
optsteps
SELECT * FROM a WHERE EXISTS(SELECT * FROM xy WHERE y=i)
----
================================================================================
Initial expression
  Cost: 2160.00
================================================================================
  select
   ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
   ├── key: (1)
   ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   ├── scan a
   │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
   │    ├── key: (1)
   │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   └── filters [type=bool, outer=(2)]
        └── exists [type=bool, outer=(2)]
             └── select
                  ├── columns: x:6(int!null) y:7(int!null)
                  ├── outer: (2)
                  ├── key: (6)
                  ├── fd: ()-->(7)
                  ├── scan xy
                  │    ├── columns: x:6(int!null) y:7(int)
                  │    ├── key: (6)
                  │    └── fd: (6)-->(7)
                  └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
                       └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
================================================================================
HoistSelectExists
  Cost: 2182.68
================================================================================
   select
    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - ├── scan a
  + ├── semi-join-apply
    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    ├── key: (1)
  - │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - └── filters [type=bool, outer=(2)]
  -      └── exists [type=bool, outer=(2)]
  -           └── select
  -                ├── columns: x:6(int!null) y:7(int!null)
  -                ├── outer: (2)
  -                ├── key: (6)
  -                ├── fd: ()-->(7)
  -                ├── scan xy
  -                │    ├── columns: x:6(int!null) y:7(int)
  -                │    ├── key: (6)
  -                │    └── fd: (6)-->(7)
  -                └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  -                     └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
  + │    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  + │    ├── scan a
  + │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  + │    │    ├── key: (1)
  + │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  + │    ├── select
  + │    │    ├── columns: x:6(int!null) y:7(int!null)
  + │    │    ├── outer: (2)
  + │    │    ├── key: (6)
  + │    │    ├── fd: ()-->(7)
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:6(int!null) y:7(int)
  + │    │    │    ├── key: (6)
  + │    │    │    └── fd: (6)-->(7)
  + │    │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  + │    │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
  + │    └── true [type=bool]
  + └── filters [type=bool]
================================================================================
TryDecorrelateSelect
  Cost: 2190.00
================================================================================
   select
  - ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  + ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    ├── semi-join-apply
  - │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  + │    ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
    │    ├── key: (1)
    │    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    │    ├── scan a
    │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    │    ├── key: (1)
    │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - │    ├── select
  - │    │    ├── columns: x:6(int!null) y:7(int!null)
  - │    │    ├── outer: (2)
  + │    ├── scan xy
  + │    │    ├── columns: x:6(int!null) y:7(int)
    │    │    ├── key: (6)
  - │    │    ├── fd: ()-->(7)
  - │    │    ├── scan xy
  - │    │    │    ├── columns: x:6(int!null) y:7(int)
  - │    │    │    ├── key: (6)
  - │    │    │    └── fd: (6)-->(7)
  - │    │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  - │    │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
  - │    └── true [type=bool]
  + │    │    └── fd: (6)-->(7)
  + │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  + │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
    └── filters [type=bool]
================================================================================
DecorrelateJoin
  Cost: 2190.00
================================================================================
   select
  - ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
  + ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - ├── semi-join-apply
  - │    ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb)
  + ├── semi-join
  + │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    ├── key: (1)
    │    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    │    ├── scan a
    │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    │    ├── key: (1)
    │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    │    ├── scan xy
    │    │    ├── columns: x:6(int!null) y:7(int)
    │    │    ├── key: (6)
    │    │    └── fd: (6)-->(7)
    │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
    │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
    └── filters [type=bool]
================================================================================
EliminateEmptyFilters
  Cost: 2190.00
================================================================================
   select
    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    ├── semi-join
    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    ├── key: (1)
    │    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    │    ├── scan a
    │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    │    ├── key: (1)
    │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    │    ├── scan xy
    │    │    ├── columns: x:6(int!null) y:7(int)
    │    │    ├── key: (6)
    │    │    └── fd: (6)-->(7)
    │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
    │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
  - └── filters [type=bool]
  + └── true [type=bool]
================================================================================
EliminateSelect
  Cost: 2180.00
================================================================================
  -select
  +semi-join
    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - ├── semi-join
  + ├── scan a
    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
    │    ├── key: (1)
  - │    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - │    ├── scan a
  - │    │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
  - │    │    ├── key: (1)
  - │    │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - │    ├── scan xy
  - │    │    ├── columns: x:6(int!null) y:7(int)
  - │    │    ├── key: (6)
  - │    │    └── fd: (6)-->(7)
  - │    └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  - │         └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
  - └── true [type=bool]
  + │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  + ├── scan xy
  + │    ├── columns: x:6(int!null) y:7(int)
  + │    ├── key: (6)
  + │    └── fd: (6)-->(7)
  + └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
  +      └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateMergeJoins (no changes)
--------------------------------------------------------------------------------
================================================================================
Final best expression
  Cost: 2180.00
================================================================================
  semi-join
   ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
   ├── key: (1)
   ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   ├── scan a
   │    ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb)
   │    ├── key: (1)
   │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   ├── scan xy
   │    ├── columns: x:6(int!null) y:7(int)
   │    ├── key: (6)
   │    └── fd: (6)-->(7)
   └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)]
        └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])]

# Decorrelation pattern using ANY function.
optsteps
SELECT 5=ANY(SELECT i FROM a WHERE k=x) AS r FROM xy
----
================================================================================
Initial expression
  Cost: 2170.01
================================================================================
  project
   ├── columns: r:8(bool)
   ├── scan xy
   │    ├── columns: x:1(int!null) y:2(int)
   │    ├── key: (1)
   │    └── fd: (1)-->(2)
   └── projections [outer=(1)]
        └── any: eq [type=bool, outer=(1)]
             ├── project
             │    ├── columns: i:4(int)
             │    ├── outer: (1)
             │    ├── cardinality: [0 - 1]
             │    ├── key: ()
             │    ├── fd: ()-->(4)
             │    └── select
             │         ├── columns: k:3(int!null) i:4(int) f:5(float) s:6(string) j:7(jsonb)
             │         ├── outer: (1)
             │         ├── cardinality: [0 - 1]
             │         ├── key: ()
             │         ├── fd: ()-->(3-7)
             │         ├── scan a
             │         │    ├── columns: k:3(int!null) i:4(int) f:5(float) s:6(string) j:7(jsonb)
             │         │    ├── key: (3)
             │         │    └── fd: (3)-->(4-7), (5,6)~~>(3,4,7)
             │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
             │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
             └── const: 5 [type=int]
================================================================================
PruneSelectCols
  Cost: 2140.01
================================================================================
   project
    ├── columns: r:8(bool)
    ├── scan xy
    │    ├── columns: x:1(int!null) y:2(int)
    │    ├── key: (1)
    │    └── fd: (1)-->(2)
    └── projections [outer=(1)]
         └── any: eq [type=bool, outer=(1)]
              ├── project
              │    ├── columns: i:4(int)
              │    ├── outer: (1)
              │    ├── cardinality: [0 - 1]
              │    ├── key: ()
              │    ├── fd: ()-->(4)
              │    └── select
  -           │         ├── columns: k:3(int!null) i:4(int) f:5(float) s:6(string) j:7(jsonb)
  +           │         ├── columns: k:3(int!null) i:4(int)
              │         ├── outer: (1)
              │         ├── cardinality: [0 - 1]
              │         ├── key: ()
  -           │         ├── fd: ()-->(3-7)
  +           │         ├── fd: ()-->(3,4)
              │         ├── scan a
  -           │         │    ├── columns: k:3(int!null) i:4(int) f:5(float) s:6(string) j:7(jsonb)
  +           │         │    ├── columns: k:3(int!null) i:4(int)
              │         │    ├── key: (3)
  -           │         │    └── fd: (3)-->(4-7), (5,6)~~>(3,4,7)
  +           │         │    └── fd: (3)-->(4)
              │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
              │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
              └── const: 5 [type=int]
================================================================================
PruneScanCols
  Cost: 2130.01
================================================================================
   project
    ├── columns: r:8(bool)
    ├── scan xy
  - │    ├── columns: x:1(int!null) y:2(int)
  - │    ├── key: (1)
  - │    └── fd: (1)-->(2)
  + │    ├── columns: x:1(int!null)
  + │    └── key: (1)
    └── projections [outer=(1)]
         └── any: eq [type=bool, outer=(1)]
              ├── project
              │    ├── columns: i:4(int)
              │    ├── outer: (1)
              │    ├── cardinality: [0 - 1]
              │    ├── key: ()
              │    ├── fd: ()-->(4)
              │    └── select
              │         ├── columns: k:3(int!null) i:4(int)
              │         ├── outer: (1)
              │         ├── cardinality: [0 - 1]
              │         ├── key: ()
              │         ├── fd: ()-->(3,4)
              │         ├── scan a
              │         │    ├── columns: k:3(int!null) i:4(int)
              │         │    ├── key: (3)
              │         │    └── fd: (3)-->(4)
              │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
              │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
              └── const: 5 [type=int]
================================================================================
HoistProjectSubquery
  Cost: 2152.58
================================================================================
   project
    ├── columns: r:8(bool)
  - ├── scan xy
  - │    ├── columns: x:1(int!null)
  - │    └── key: (1)
  - └── projections [outer=(1)]
  -      └── any: eq [type=bool, outer=(1)]
  -           ├── project
  -           │    ├── columns: i:4(int)
  -           │    ├── outer: (1)
  -           │    ├── cardinality: [0 - 1]
  -           │    ├── key: ()
  -           │    ├── fd: ()-->(4)
  -           │    └── select
  -           │         ├── columns: k:3(int!null) i:4(int)
  -           │         ├── outer: (1)
  -           │         ├── cardinality: [0 - 1]
  -           │         ├── key: ()
  -           │         ├── fd: ()-->(3,4)
  -           │         ├── scan a
  -           │         │    ├── columns: k:3(int!null) i:4(int)
  -           │         │    ├── key: (3)
  -           │         │    └── fd: (3)-->(4)
  -           │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  -           │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  -           └── const: 5 [type=int]
  + ├── inner-join-apply
  + │    ├── columns: x:1(int!null) case:11(bool)
  + │    ├── key: (1)
  + │    ├── fd: (1)-->(11)
  + │    ├── scan xy
  + │    │    ├── columns: x:1(int!null)
  + │    │    └── key: (1)
  + │    ├── project
  + │    │    ├── columns: case:11(bool)
  + │    │    ├── outer: (1)
  + │    │    ├── cardinality: [1 - 1]
  + │    │    ├── key: ()
  + │    │    ├── fd: ()-->(11)
  + │    │    ├── scalar-group-by
  + │    │    │    ├── columns: bool_or:10(bool)
  + │    │    │    ├── outer: (1)
  + │    │    │    ├── cardinality: [1 - 1]
  + │    │    │    ├── key: ()
  + │    │    │    ├── fd: ()-->(10)
  + │    │    │    ├── project
  + │    │    │    │    ├── columns: notnull:9(bool)
  + │    │    │    │    ├── outer: (1)
  + │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    ├── key: ()
  + │    │    │    │    ├── fd: ()-->(9)
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: i:4(int)
  + │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    ├── fd: ()-->(4)
  + │    │    │    │    │    ├── project
  + │    │    │    │    │    │    ├── columns: i:4(int)
  + │    │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    │    ├── fd: ()-->(4)
  + │    │    │    │    │    │    └── select
  + │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │         ├── outer: (1)
  + │    │    │    │    │    │         ├── cardinality: [0 - 1]
  + │    │    │    │    │    │         ├── key: ()
  + │    │    │    │    │    │         ├── fd: ()-->(3,4)
  + │    │    │    │    │    │         ├── scan a
  + │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │         │    ├── key: (3)
  + │    │    │    │    │    │         │    └── fd: (3)-->(4)
  + │    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         └── (5 = i) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    └── projections [outer=(4)]
  + │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    └── aggregations [outer=(9)]
  + │    │    │         └── bool-or [type=bool, outer=(9)]
  + │    │    │              └── variable: notnull [type=bool, outer=(9)]
  + │    │    └── projections [outer=(10)]
  + │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
  + │    └── true [type=bool]
  + └── projections [outer=(11)]
  +      └── variable: case [type=bool, outer=(11)]
================================================================================
CommuteVar
  Cost: 2152.58
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(3,4)
    │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │    │         │    └── fd: (3)-->(4)
    │    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         └── (5 = i) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PushSelectIntoProject
  Cost: 2152.57
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(3,4)
  - │    │    │    │    │    │         ├── scan a
  + │    │    │    │    │    │         ├── select
    │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │         │    ├── key: (3)
  - │    │    │    │    │    │         │    └── fd: (3)-->(4)
  - │    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    │         │    ├── outer: (1)
  + │    │    │    │    │    │         │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │         │    ├── key: ()
  + │    │    │    │    │    │         │    ├── fd: ()-->(3,4)
  + │    │    │    │    │    │         │    ├── scan a
  + │    │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │         │    │    ├── key: (3)
  + │    │    │    │    │    │         │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    │         │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │    │         │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │    │         └── filters [type=bool, outer=(4)]
  + │    │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    └── filters [type=bool]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
MergeSelects
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(3,4)
  - │    │    │    │    │    │         ├── select
  + │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │         │    ├── outer: (1)
  - │    │    │    │    │    │         │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │         │    ├── key: ()
  - │    │    │    │    │    │         │    ├── fd: ()-->(3,4)
  - │    │    │    │    │    │         │    ├── scan a
  - │    │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │         │    │    ├── key: (3)
  - │    │    │    │    │    │         │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    │         │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │    │         │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │    │         └── filters [type=bool, outer=(4)]
  + │    │    │    │    │    │         │    ├── key: (3)
  + │    │    │    │    │    │         │    └── fd: (3)-->(4)
  + │    │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    │    └── filters [type=bool]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateEmptyFilters
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(4)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(3,4)
    │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │    │         │    └── fd: (3)-->(4)
    │    │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    └── filters [type=bool]
  + │    │    │    │    │    └── true [type=bool]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateSelect
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
  - │    │    │    │    ├── select
  + │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(4)
  - │    │    │    │    │    ├── project
  - │    │    │    │    │    │    ├── columns: i:4(int)
  - │    │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    ├── fd: ()-->(4)
  - │    │    │    │    │    │    └── select
  - │    │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │         ├── outer: (1)
  - │    │    │    │    │    │         ├── cardinality: [0 - 1]
  - │    │    │    │    │    │         ├── key: ()
  - │    │    │    │    │    │         ├── fd: ()-->(3,4)
  - │    │    │    │    │    │         ├── scan a
  - │    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │         │    ├── key: (3)
  - │    │    │    │    │    │         │    └── fd: (3)-->(4)
  - │    │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    └── true [type=bool]
  + │    │    │    │    │    └── select
  + │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         ├── outer: (1)
  + │    │    │    │    │         ├── cardinality: [0 - 1]
  + │    │    │    │    │         ├── key: ()
  + │    │    │    │    │         ├── fd: ()-->(3,4)
  + │    │    │    │    │         ├── scan a
  + │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    ├── key: (3)
  + │    │    │    │    │         │    └── fd: (3)-->(4)
  + │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateProjectProject
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: i:4(int)
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(4)
  - │    │    │    │    │    └── select
  - │    │    │    │    │         ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         ├── outer: (1)
  - │    │    │    │    │         ├── cardinality: [0 - 1]
  - │    │    │    │    │         ├── key: ()
  - │    │    │    │    │         ├── fd: ()-->(3,4)
  - │    │    │    │    │         ├── scan a
  - │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    ├── key: (3)
  - │    │    │    │    │         │    └── fd: (3)-->(4)
  - │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    ├── fd: ()-->(3,4)
  + │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
    │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
FoldNonNullIsNotNull
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(3,4)
    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    │    └── fd: (3)-->(4)
    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
  - │    │         └── CASE WHEN bool_or AND (5 IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
  + │    │         └── CASE WHEN bool_or AND true THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
SimplifyAnd
  Cost: 2152.56
================================================================================
   project
    ├── columns: r:8(bool)
    ├── inner-join-apply
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── scan xy
    │    │    ├── columns: x:1(int!null)
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:11(bool)
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(11)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(10)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(3,4)
    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    │    └── fd: (3)-->(4)
    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── aggregations [outer=(9)]
    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(10)]
  - │    │         └── CASE WHEN bool_or AND true THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
  + │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
--------------------------------------------------------------------------------
EliminateSingletonAndOr (no changes)
--------------------------------------------------------------------------------
================================================================================
TryDecorrelateProject
  Cost: 2182.54
================================================================================
   project
    ├── columns: r:8(bool)
  - ├── inner-join-apply
  + ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
  - │    ├── scan xy
  - │    │    ├── columns: x:1(int!null)
  - │    │    └── key: (1)
    │    ├── project
  - │    │    ├── columns: case:11(bool)
  - │    │    ├── outer: (1)
  - │    │    ├── cardinality: [1 - 1]
  - │    │    ├── key: ()
  - │    │    ├── fd: ()-->(11)
  - │    │    ├── scalar-group-by
  - │    │    │    ├── columns: bool_or:10(bool)
  - │    │    │    ├── outer: (1)
  - │    │    │    ├── cardinality: [1 - 1]
  - │    │    │    ├── key: ()
  - │    │    │    ├── fd: ()-->(10)
  - │    │    │    ├── project
  - │    │    │    │    ├── columns: notnull:9(bool)
  + │    │    ├── columns: case:11(bool) x:1(int!null)
  + │    │    ├── key: (1)
  + │    │    ├── fd: (1)-->(11)
  + │    │    ├── inner-join-apply
  + │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  + │    │    │    ├── key: (1)
  + │    │    │    ├── fd: (1)-->(10)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1(int!null)
  + │    │    │    │    └── key: (1)
  + │    │    │    ├── scalar-group-by
  + │    │    │    │    ├── columns: bool_or:10(bool)
    │    │    │    │    ├── outer: (1)
  - │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    │    ├── key: ()
  - │    │    │    │    ├── fd: ()-->(9)
  - │    │    │    │    ├── select
  - │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    ├── fd: ()-->(10)
  + │    │    │    │    ├── project
  + │    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(3,4)
  - │    │    │    │    │    ├── scan a
  + │    │    │    │    │    ├── fd: ()-->(9)
  + │    │    │    │    │    ├── select
    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    └── projections [outer=(4)]
  - │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    └── aggregations [outer=(9)]
  - │    │    │         └── bool-or [type=bool, outer=(9)]
  - │    │    │              └── variable: notnull [type=bool, outer=(9)]
  - │    │    └── projections [outer=(10)]
  + │    │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    │    ├── fd: ()-->(3,4)
  + │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    └── projections [outer=(4)]
  + │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    └── aggregations [outer=(9)]
  + │    │    │    │         └── bool-or [type=bool, outer=(9)]
  + │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
  + │    │    │    └── true [type=bool]
  + │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
TryDecorrelateScalarGroupBy
  Cost: 2159.18
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
  - │    │    ├── inner-join-apply
  + │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    │    └── key: (1)
  - │    │    │    ├── scalar-group-by
  - │    │    │    │    ├── columns: bool_or:10(bool)
  - │    │    │    │    ├── outer: (1)
  - │    │    │    │    ├── cardinality: [1 - 1]
  - │    │    │    │    ├── key: ()
  - │    │    │    │    ├── fd: ()-->(10)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: notnull:9(bool)
  - │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(9)
  - │    │    │    │    │    ├── select
  - │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    ├── group-by
  + │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  + │    │    │    │    ├── grouping columns: x:1(int!null)
  + │    │    │    │    ├── key: (1)
  + │    │    │    │    ├── fd: (1)-->(10)
  + │    │    │    │    ├── left-join-apply
  + │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
  + │    │    │    │    │    ├── key: (1)
  + │    │    │    │    │    ├── fd: (1)-->(9)
  + │    │    │    │    │    ├── scan xy
  + │    │    │    │    │    │    ├── columns: x:1(int!null)
  + │    │    │    │    │    │    └── key: (1)
  + │    │    │    │    │    ├── project
  + │    │    │    │    │    │    ├── columns: notnull:9(bool)
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    ├── fd: ()-->(3,4)
  - │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    ├── fd: ()-->(9)
  + │    │    │    │    │    │    ├── select
    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    └── projections [outer=(4)]
  - │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    │    │    ├── fd: ()-->(3,4)
  + │    │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    │    └── projections [outer=(4)]
  + │    │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │    └── true [type=bool]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
TryDecorrelateProjectSelect
  Cost: 2270.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
  - │    │    │    │    ├── left-join-apply
  + │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
  - │    │    │    │    │    ├── key: (1)
  - │    │    │    │    │    ├── fd: (1)-->(9)
  - │    │    │    │    │    ├── scan xy
  - │    │    │    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    │    │    │    └── key: (1)
  - │    │    │    │    │    ├── project
  - │    │    │    │    │    │    ├── columns: notnull:9(bool)
  - │    │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    ├── fd: ()-->(9)
  - │    │    │    │    │    │    ├── select
  - │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    │    ├── fd: ()-->(3,4)
  - │    │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    │    │    └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │    │    │         ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    │    └── projections [outer=(4)]
  - │    │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │    └── true [type=bool]
  + │    │    │    │    │    └── left-join-apply
  + │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
  + │    │    │    │    │         ├── key: (1,3)
  + │    │    │    │    │         ├── fd: (1,3)-->(4,9)
  + │    │    │    │    │         ├── scan xy
  + │    │    │    │    │         │    ├── columns: x:1(int!null)
  + │    │    │    │    │         │    └── key: (1)
  + │    │    │    │    │         ├── project
  + │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         │    ├── key: (3)
  + │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
  + │    │    │    │    │         │    ├── scan a
  + │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    │    ├── key: (3)
  + │    │    │    │    │         │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    └── projections [outer=(3,4)]
  + │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
DecorrelateJoin
  Cost: 2270.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
  - │    │    │    │    │    └── left-join-apply
  + │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
  - │    │    │    │    │         ├── fd: (1,3)-->(4,9)
  + │    │    │    │    │         ├── fd: (3)-->(4), (4)~~>(9), (1,3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
    │    │    │    │    │         ├── project
    │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
    │    │    │    │    │         │    ├── scan a
    │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    ├── key: (3)
    │    │    │    │    │         │    │    └── fd: (3)-->(4)
    │    │    │    │    │         │    └── projections [outer=(3,4)]
    │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PushFilterIntoJoinRight
  Cost: 2268.33
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
    │    │    │    │    │         ├── fd: (3)-->(4), (4)~~>(9), (1,3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
  - │    │    │    │    │         ├── project
  - │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         ├── select
  + │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int) notnull:9(bool)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
  - │    │    │    │    │         │    ├── scan a
  - │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    ├── project
  + │    │    │    │    │         │    │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    ├── key: (3)
  - │    │    │    │    │         │    │    └── fd: (3)-->(4)
  - │    │    │    │    │         │    └── projections [outer=(3,4)]
  - │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │         └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │              ├── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    │              └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         │    │    ├── fd: (3)-->(4), (4)-->(9)
  + │    │    │    │    │         │    │    ├── scan a
  + │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    │    │    ├── key: (3)
  + │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    │    └── projections [outer=(3,4)]
  + │    │    │    │    │         │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │         │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PushSelectIntoProject
  Cost: 2258.33
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
    │    │    │    │    │         ├── fd: (3)-->(4), (4)~~>(9), (1,3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
    │    │    │    │    │         ├── select
    │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int) notnull:9(bool)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
    │    │    │    │    │         │    ├── project
    │    │    │    │    │         │    │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    ├── key: (3)
    │    │    │    │    │         │    │    ├── fd: (3)-->(4), (4)-->(9)
  - │    │    │    │    │         │    │    ├── scan a
  + │    │    │    │    │         │    │    ├── select
    │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    │    ├── key: (3)
  - │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │         │    │    │    ├── scan a
  + │    │    │    │    │         │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    │    │    │    ├── key: (3)
  + │    │    │    │    │         │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    │         │    │    └── projections [outer=(3,4)]
    │    │    │    │    │         │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │         │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         │    └── true [type=bool]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateSelect
  Cost: 2255.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
    │    │    │    │    │         ├── fd: (3)-->(4), (4)~~>(9), (1,3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
  - │    │    │    │    │         ├── select
  - │    │    │    │    │         │    ├── columns: k:3(int!null) i:4(int) notnull:9(bool)
  + │    │    │    │    │         ├── project
  + │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
  - │    │    │    │    │         │    ├── project
  - │    │    │    │    │         │    │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         │    ├── select
  + │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    ├── key: (3)
  - │    │    │    │    │         │    │    ├── fd: (3)-->(4), (4)-->(9)
  - │    │    │    │    │         │    │    ├── select
  + │    │    │    │    │         │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │         │    │    ├── scan a
    │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │    │    │    ├── key: (3)
  - │    │    │    │    │         │    │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │         │    │    │    ├── scan a
  - │    │    │    │    │         │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    │    │    │    ├── key: (3)
  - │    │    │    │    │         │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │         │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │         │    │    └── projections [outer=(3,4)]
  - │    │    │    │    │         │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │         │    └── true [type=bool]
  + │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         │    └── projections [outer=(3,4)]
  + │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PruneJoinRightCols
  Cost: 2258.33
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
  - │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) i:4(int) notnull:9(bool)
  + │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
  - │    │    │    │    │         ├── fd: (3)-->(4), (4)~~>(9), (1,3)-->(9)
  + │    │    │    │    │         ├── fd: (3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
    │    │    │    │    │         ├── project
  - │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         │    ├── columns: k:3(int!null) notnull:9(bool)
    │    │    │    │    │         │    ├── key: (3)
  - │    │    │    │    │         │    ├── fd: (3)-->(4), (4)-->(9)
  - │    │    │    │    │         │    ├── select
  - │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    │    ├── key: (3)
  - │    │    │    │    │         │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │         │    │    ├── scan a
  - │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    │    │    ├── key: (3)
  - │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │         │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │         │    └── projections [outer=(3,4)]
  - │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │         │    ├── fd: (3)-->(9)
  + │    │    │    │    │         │    └── project
  + │    │    │    │    │         │         ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         │         ├── key: (3)
  + │    │    │    │    │         │         ├── fd: (3)-->(4), (4)-->(9)
  + │    │    │    │    │         │         ├── select
  + │    │    │    │    │         │         │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │         │    ├── key: (3)
  + │    │    │    │    │         │         │    ├── fd: (3)-->(4)
  + │    │    │    │    │         │         │    ├── scan a
  + │    │    │    │    │         │         │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │         │    │    ├── key: (3)
  + │    │    │    │    │         │         │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │         │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         │         │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         │         └── projections [outer=(3,4)]
  + │    │    │    │    │         │              └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PruneProjectCols
  Cost: 2258.33
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
    │    │    │    │    │         ├── fd: (3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
    │    │    │    │    │         ├── project
    │    │    │    │    │         │    ├── columns: k:3(int!null) notnull:9(bool)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(9)
    │    │    │    │    │         │    └── project
  - │    │    │    │    │         │         ├── columns: notnull:9(bool) k:3(int!null) i:4(int)
  + │    │    │    │    │         │         ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    │    │         │         ├── key: (3)
  - │    │    │    │    │         │         ├── fd: (3)-->(4), (4)-->(9)
  + │    │    │    │    │         │         ├── fd: (3)-->(9)
    │    │    │    │    │         │         ├── select
    │    │    │    │    │         │         │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │         │    ├── key: (3)
    │    │    │    │    │         │         │    ├── fd: (3)-->(4)
    │    │    │    │    │         │         │    ├── scan a
    │    │    │    │    │         │         │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │         │         │    │    ├── key: (3)
    │    │    │    │    │         │         │    │    └── fd: (3)-->(4)
    │    │    │    │    │         │         │    └── filters [type=bool, outer=(4)]
    │    │    │    │    │         │         │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    │         │         └── projections [outer=(3,4)]
    │    │    │    │    │         │              └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateProject
  Cost: 2255.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
    │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
    │    │    │    │    │    └── left-join
    │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    │    │    │         ├── key: (1,3)
    │    │    │    │    │         ├── fd: (3)-->(9)
    │    │    │    │    │         ├── scan xy
    │    │    │    │    │         │    ├── columns: x:1(int!null)
    │    │    │    │    │         │    └── key: (1)
    │    │    │    │    │         ├── project
  - │    │    │    │    │         │    ├── columns: k:3(int!null) notnull:9(bool)
  + │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    │    │         │    ├── key: (3)
    │    │    │    │    │         │    ├── fd: (3)-->(9)
  - │    │    │    │    │         │    └── project
  - │    │    │    │    │         │         ├── columns: notnull:9(bool) k:3(int!null)
  - │    │    │    │    │         │         ├── key: (3)
  - │    │    │    │    │         │         ├── fd: (3)-->(9)
  - │    │    │    │    │         │         ├── select
  - │    │    │    │    │         │         │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │         │    ├── key: (3)
  - │    │    │    │    │         │         │    ├── fd: (3)-->(4)
  - │    │    │    │    │         │         │    ├── scan a
  - │    │    │    │    │         │         │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │         │    │    ├── key: (3)
  - │    │    │    │    │         │         │    │    └── fd: (3)-->(4)
  - │    │    │    │    │         │         │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         │         │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │         │         └── projections [outer=(3,4)]
  - │    │    │    │    │         │              └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │         │    ├── select
  + │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    │    ├── key: (3)
  + │    │    │    │    │         │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │         │    │    ├── scan a
  + │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │         │    │    │    ├── key: (3)
  + │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │         │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │         │    └── projections [outer=(3,4)]
  + │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateGroupByProject
  Cost: 2245.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
    │    │    ├── select
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
    │    │    │    ├── group-by
    │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(10)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: x:1(int!null) notnull:9(bool)
  - │    │    │    │    │    └── left-join
  - │    │    │    │    │         ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  - │    │    │    │    │         ├── key: (1,3)
  - │    │    │    │    │         ├── fd: (3)-->(9)
  - │    │    │    │    │         ├── scan xy
  - │    │    │    │    │         │    ├── columns: x:1(int!null)
  - │    │    │    │    │         │    └── key: (1)
  - │    │    │    │    │         ├── project
  - │    │    │    │    │         │    ├── columns: notnull:9(bool) k:3(int!null)
  - │    │    │    │    │         │    ├── key: (3)
  - │    │    │    │    │         │    ├── fd: (3)-->(9)
  - │    │    │    │    │         │    ├── select
  - │    │    │    │    │         │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    │    ├── key: (3)
  - │    │    │    │    │         │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │         │    │    ├── scan a
  - │    │    │    │    │         │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │         │    │    │    ├── key: (3)
  - │    │    │    │    │         │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │         │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │         │    └── projections [outer=(3,4)]
  - │    │    │    │    │         │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │         └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │              └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    │    ├── left-join
  + │    │    │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  + │    │    │    │    │    ├── key: (1,3)
  + │    │    │    │    │    ├── fd: (3)-->(9)
  + │    │    │    │    │    ├── scan xy
  + │    │    │    │    │    │    ├── columns: x:1(int!null)
  + │    │    │    │    │    │    └── key: (1)
  + │    │    │    │    │    ├── project
  + │    │    │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    ├── fd: (3)-->(9)
  + │    │    │    │    │    │    ├── select
  + │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  + │    │    │    │    │    │    │    │    ├── key: (3)
  + │    │    │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    │    └── projections [outer=(3,4)]
  + │    │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    │    │    └── aggregations [outer=(9)]
    │    │    │    │         └── bool-or [type=bool, outer=(9)]
    │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    │    └── true [type=bool]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateSelect
  Cost: 2235.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── select
    │    ├── columns: x:1(int!null) case:11(bool)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
    │    ├── project
    │    │    ├── columns: case:11(bool) x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(11)
  - │    │    ├── select
  + │    │    ├── group-by
    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  + │    │    │    ├── grouping columns: x:1(int!null)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(10)
  - │    │    │    ├── group-by
  - │    │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  - │    │    │    │    ├── grouping columns: x:1(int!null)
  - │    │    │    │    ├── key: (1)
  - │    │    │    │    ├── fd: (1)-->(10)
  - │    │    │    │    ├── left-join
  - │    │    │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  - │    │    │    │    │    ├── key: (1,3)
  + │    │    │    ├── left-join
  + │    │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  + │    │    │    │    ├── key: (1,3)
  + │    │    │    │    ├── fd: (3)-->(9)
  + │    │    │    │    ├── scan xy
  + │    │    │    │    │    ├── columns: x:1(int!null)
  + │    │    │    │    │    └── key: (1)
  + │    │    │    │    ├── project
  + │    │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    │    │    ├── scan xy
  - │    │    │    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    │    │    │    └── key: (1)
  - │    │    │    │    │    ├── project
  - │    │    │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    │    │    ├── select
  + │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    │    │    │    ├── select
  + │    │    │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    │    └── projections [outer=(3,4)]
  - │    │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    │    └── aggregations [outer=(9)]
  - │    │    │    │         └── bool-or [type=bool, outer=(9)]
  - │    │    │    │              └── variable: notnull [type=bool, outer=(9)]
  - │    │    │    └── true [type=bool]
  + │    │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    │    └── projections [outer=(3,4)]
  + │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    │    └── aggregations [outer=(9)]
  + │    │    │         └── bool-or [type=bool, outer=(9)]
  + │    │    │              └── variable: notnull [type=bool, outer=(9)]
    │    │    └── projections [outer=(1,10)]
    │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    │    └── true [type=bool]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
EliminateSelect
  Cost: 2225.00
================================================================================
   project
    ├── columns: r:8(bool)
  - ├── select
  - │    ├── columns: x:1(int!null) case:11(bool)
  + ├── project
  + │    ├── columns: case:11(bool) x:1(int!null)
    │    ├── key: (1)
    │    ├── fd: (1)-->(11)
  - │    ├── project
  - │    │    ├── columns: case:11(bool) x:1(int!null)
  + │    ├── group-by
  + │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  + │    │    ├── grouping columns: x:1(int!null)
    │    │    ├── key: (1)
  - │    │    ├── fd: (1)-->(11)
  - │    │    ├── group-by
  - │    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  - │    │    │    ├── grouping columns: x:1(int!null)
  - │    │    │    ├── key: (1)
  - │    │    │    ├── fd: (1)-->(10)
  - │    │    │    ├── left-join
  - │    │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  - │    │    │    │    ├── key: (1,3)
  + │    │    ├── fd: (1)-->(10)
  + │    │    ├── left-join
  + │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  + │    │    │    ├── key: (1,3)
  + │    │    │    ├── fd: (3)-->(9)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1(int!null)
  + │    │    │    │    └── key: (1)
  + │    │    │    ├── project
  + │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    │    ├── key: (3)
    │    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    │    ├── scan xy
  - │    │    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    │    │    └── key: (1)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    │    │    ├── select
  + │    │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    │    └── projections [outer=(3,4)]
  - │    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    │    └── aggregations [outer=(9)]
  - │    │    │         └── bool-or [type=bool, outer=(9)]
  - │    │    │              └── variable: notnull [type=bool, outer=(9)]
  - │    │    └── projections [outer=(1,10)]
  - │    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
  - │    └── true [type=bool]
  + │    │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    │    └── projections [outer=(3,4)]
  + │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    └── aggregations [outer=(9)]
  + │    │         └── bool-or [type=bool, outer=(9)]
  + │    │              └── variable: notnull [type=bool, outer=(9)]
  + │    └── projections [outer=(1,10)]
  + │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
PruneProjectCols
  Cost: 2225.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── project
  - │    ├── columns: case:11(bool) x:1(int!null)
  - │    ├── key: (1)
  - │    ├── fd: (1)-->(11)
  + │    ├── columns: case:11(bool)
    │    ├── group-by
    │    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    │    ├── grouping columns: x:1(int!null)
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(10)
    │    │    ├── left-join
    │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    │    ├── key: (1,3)
    │    │    │    ├── fd: (3)-->(9)
    │    │    │    ├── scan xy
    │    │    │    │    ├── columns: x:1(int!null)
    │    │    │    │    └── key: (1)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    │    ├── key: (3)
    │    │    │    │    ├── fd: (3)-->(9)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    ├── fd: (3)-->(4)
    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    │    └── fd: (3)-->(4)
    │    │    │    │    │    └── filters [type=bool, outer=(4)]
    │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    │    └── projections [outer=(3,4)]
    │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    │    └── aggregations [outer=(9)]
    │    │         └── bool-or [type=bool, outer=(9)]
    │    │              └── variable: notnull [type=bool, outer=(9)]
  - │    └── projections [outer=(1,10)]
  + │    └── projections [outer=(10)]
    │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
    └── projections [outer=(11)]
         └── variable: case [type=bool, outer=(11)]
================================================================================
InlineProjectInProject
  Cost: 2205.00
================================================================================
   project
    ├── columns: r:8(bool)
  - ├── project
  - │    ├── columns: case:11(bool)
  - │    ├── group-by
  - │    │    ├── columns: x:1(int!null) bool_or:10(bool)
  - │    │    ├── grouping columns: x:1(int!null)
  - │    │    ├── key: (1)
  - │    │    ├── fd: (1)-->(10)
  - │    │    ├── left-join
  - │    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  - │    │    │    ├── key: (1,3)
  + ├── group-by
  + │    ├── columns: x:1(int!null) bool_or:10(bool)
  + │    ├── grouping columns: x:1(int!null)
  + │    ├── key: (1)
  + │    ├── fd: (1)-->(10)
  + │    ├── left-join
  + │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
  + │    │    ├── key: (1,3)
  + │    │    ├── fd: (3)-->(9)
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:1(int!null)
  + │    │    │    └── key: (1)
  + │    │    ├── project
  + │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    ├── key: (3)
    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    │    └── key: (1)
  - │    │    │    ├── project
  - │    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
  + │    │    │    ├── select
  + │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    ├── key: (3)
  - │    │    │    │    ├── fd: (3)-->(9)
  - │    │    │    │    ├── select
  + │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    ├── fd: (3)-->(4)
  - │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
  - │    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    │    └── fd: (3)-->(4)
  - │    │    │    │    │    └── filters [type=bool, outer=(4)]
  - │    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  - │    │    │    │    └── projections [outer=(3,4)]
  - │    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  - │    │    └── aggregations [outer=(9)]
  - │    │         └── bool-or [type=bool, outer=(9)]
  - │    │              └── variable: notnull [type=bool, outer=(9)]
  - │    └── projections [outer=(10)]
  - │         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
  - └── projections [outer=(11)]
  -      └── variable: case [type=bool, outer=(11)]
  + │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    └── filters [type=bool, outer=(4)]
  + │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
  + │    │    │    └── projections [outer=(3,4)]
  + │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  + │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    └── aggregations [outer=(9)]
  + │         └── bool-or [type=bool, outer=(9)]
  + │              └── variable: notnull [type=bool, outer=(9)]
  + └── projections [outer=(10)]
  +      └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateConstrainedScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
CommuteLeftJoin (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:8(bool)
    ├── group-by
    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    ├── grouping columns: x:1(int!null)
    │    ├── key: (1)
    │    ├── fd: (1)-->(10)
  - │    ├── left-join
  + │    ├── right-join
    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    ├── key: (1,3)
    │    │    ├── fd: (3)-->(9)
  - │    │    ├── scan xy
  - │    │    │    ├── columns: x:1(int!null)
  - │    │    │    └── key: (1)
    │    │    ├── project
    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    ├── key: (3)
    │    │    │    ├── fd: (3)-->(9)
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    ├── key: (3)
    │    │    │    │    ├── fd: (3)-->(4)
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    └── fd: (3)-->(4)
    │    │    │    │    └── filters [type=bool, outer=(4)]
    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    └── projections [outer=(3,4)]
    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:1(int!null)
  + │    │    │    └── key: (1)
    │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
    │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
    │    └── aggregations [outer=(9)]
    │         └── bool-or [type=bool, outer=(9)]
    │              └── variable: notnull [type=bool, outer=(9)]
    └── projections [outer=(10)]
         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
================================================================================
GenerateMergeJoins
  Cost: 2200.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── group-by
    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    ├── grouping columns: x:1(int!null)
    │    ├── key: (1)
    │    ├── fd: (1)-->(10)
  - │    ├── left-join
  + │    ├── left-join (merge)
    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    ├── key: (1,3)
    │    │    ├── fd: (3)-->(9)
    │    │    ├── scan xy
    │    │    │    ├── columns: x:1(int!null)
  - │    │    │    └── key: (1)
  + │    │    │    ├── key: (1)
  + │    │    │    └── ordering: +1
    │    │    ├── project
    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    ├── key: (3)
    │    │    │    ├── fd: (3)-->(9)
  + │    │    │    ├── ordering: +3
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    ├── key: (3)
    │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    ├── ordering: +3
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
  - │    │    │    │    │    └── fd: (3)-->(4)
  + │    │    │    │    │    ├── fd: (3)-->(4)
  + │    │    │    │    │    └── ordering: +3
    │    │    │    │    └── filters [type=bool, outer=(4)]
    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    └── projections [outer=(3,4)]
    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
  - │    │    └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)]
  - │    │         └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])]
  + │    │    └── merge-on
  + │    │         ├── left ordering: +1
  + │    │         ├── right ordering: +3
  + │    │         └── true [type=bool]
    │    └── aggregations [outer=(9)]
    │         └── bool-or [type=bool, outer=(9)]
    │              └── variable: notnull [type=bool, outer=(9)]
    └── projections [outer=(10)]
         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
--------------------------------------------------------------------------------
CommuteRightJoin (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateMergeJoins (no changes)
--------------------------------------------------------------------------------
================================================================================
GenerateStreamingGroupBy
  Cost: 2190.00
================================================================================
   project
    ├── columns: r:8(bool)
    ├── group-by
    │    ├── columns: x:1(int!null) bool_or:10(bool)
    │    ├── grouping columns: x:1(int!null)
  + │    ├── internal-ordering: +1
    │    ├── key: (1)
    │    ├── fd: (1)-->(10)
    │    ├── left-join (merge)
    │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
    │    │    ├── key: (1,3)
    │    │    ├── fd: (3)-->(9)
  + │    │    ├── ordering: +1
    │    │    ├── scan xy
    │    │    │    ├── columns: x:1(int!null)
    │    │    │    ├── key: (1)
    │    │    │    └── ordering: +1
    │    │    ├── project
    │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
    │    │    │    ├── key: (3)
    │    │    │    ├── fd: (3)-->(9)
    │    │    │    ├── ordering: +3
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    ├── key: (3)
    │    │    │    │    ├── fd: (3)-->(4)
    │    │    │    │    ├── ordering: +3
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
    │    │    │    │    │    ├── key: (3)
    │    │    │    │    │    ├── fd: (3)-->(4)
    │    │    │    │    │    └── ordering: +3
    │    │    │    │    └── filters [type=bool, outer=(4)]
    │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
    │    │    │    └── projections [outer=(3,4)]
    │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
    │    │    └── merge-on
    │    │         ├── left ordering: +1
    │    │         ├── right ordering: +3
    │    │         └── true [type=bool]
    │    └── aggregations [outer=(9)]
    │         └── bool-or [type=bool, outer=(9)]
    │              └── variable: notnull [type=bool, outer=(9)]
    └── projections [outer=(10)]
         └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
================================================================================
Final best expression
  Cost: 2190.00
================================================================================
  project
   ├── columns: r:8(bool)
   ├── group-by
   │    ├── columns: x:1(int!null) bool_or:10(bool)
   │    ├── grouping columns: x:1(int!null)
   │    ├── internal-ordering: +1
   │    ├── key: (1)
   │    ├── fd: (1)-->(10)
   │    ├── left-join (merge)
   │    │    ├── columns: x:1(int!null) k:3(int) notnull:9(bool)
   │    │    ├── key: (1,3)
   │    │    ├── fd: (3)-->(9)
   │    │    ├── ordering: +1
   │    │    ├── scan xy
   │    │    │    ├── columns: x:1(int!null)
   │    │    │    ├── key: (1)
   │    │    │    └── ordering: +1
   │    │    ├── project
   │    │    │    ├── columns: notnull:9(bool) k:3(int!null)
   │    │    │    ├── key: (3)
   │    │    │    ├── fd: (3)-->(9)
   │    │    │    ├── ordering: +3
   │    │    │    ├── select
   │    │    │    │    ├── columns: k:3(int!null) i:4(int)
   │    │    │    │    ├── key: (3)
   │    │    │    │    ├── fd: (3)-->(4)
   │    │    │    │    ├── ordering: +3
   │    │    │    │    ├── scan a
   │    │    │    │    │    ├── columns: k:3(int!null) i:4(int)
   │    │    │    │    │    ├── key: (3)
   │    │    │    │    │    ├── fd: (3)-->(4)
   │    │    │    │    │    └── ordering: +3
   │    │    │    │    └── filters [type=bool, outer=(4)]
   │    │    │    │         └── (i = 5) IS NOT false [type=bool, outer=(4)]
   │    │    │    └── projections [outer=(3,4)]
   │    │    │         └── i IS NOT NULL [type=bool, outer=(4)]
   │    │    └── merge-on
   │    │         ├── left ordering: +1
   │    │         ├── right ordering: +3
   │    │         └── true [type=bool]
   │    └── aggregations [outer=(9)]
   │         └── bool-or [type=bool, outer=(9)]
   │              └── variable: notnull [type=bool, outer=(9)]
   └── projections [outer=(10)]
        └── CASE WHEN bool_or THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(10)]
