Ensure that all symbol definitions in a tree are unique
The mutable state of a compiler run, consisting of immutable state of individual phases that can be updated.
Conversion of basic ASTs to a shape suitable for relational DBs.
Expand Paths to ProductNodes and TableExpansions into ProductNodes of Paths and TableRefExpansions of Paths, so that all Paths point to individual columns by index
Replace all TableNodes with TableExpansions which contain both the expansion and the original table.
Inject the proper orderings into the RowNumber nodes produced earlier by the resolveFixJoins phase.
Ensure that all collection operations are wrapped in a Bind so that we have a place for expanding references later.
Fuse sub-comprehensions into their parents.
Inline references to global symbols which occur only once in a Ref node.
Ensure that LetDynamic has been eliminated
Replace IntrinsicSymbols by AnonSymbols and collect them in a LetDynamic
A phase of the query compiler, identified by a unique name
Remove unreferenced fields from StructNodes
An immutable, stateless query compiler consisting of a series of phases
Since Nodes cannot be encoded into Scala Tuples, they have to be encoded into the Tuples' children instead, so we end up with trees like ProductNode(Select(r, ElementSymbol(1)), Select(r, ElementSymbol(2))) where r is a Ref to an expression that yields a Query of ProductNode(_, _).
Assign the AnonSymbols of fields from the left side of a Union to the right side.
Replace references to FieldSymbols in TableExpansions by the appropriate ElementSymbol
Rewrite zip joins into a form suitable for SQL (using inner joins and RowNumber columns.
Rewrite OrderBy to SortBy
Remove TableExpansions and TableRefExpansions, and flatten ProductNodes into StructNodes and remove unnecessary columns from them.
A tree transformer which replaces nodes transitively while updating some information about the tree.