Ensure that all symbol definitions in a tree are unique.
A standard skeleton for a code generator phase.
The current state of a compiler run, consisting of the current AST and additional immutable state of individual phases.
Rewrite aggregation function calls to Aggregate nodes.
Create a ResultSetMapping root node, ensure that the top-level server-side node returns a collection, and hoist client-side type conversions into the ResultSetMapping.
An optional phase which rewrites outer joins into more commonly supported operations for use on databases that lack outer join support.
Expand paths of record types to reference all fields individually and recreate the record structure at the call site.
Expand sum types and their catamorphisms to equivalent product type operations.
Expand table-valued expressions in the result type to their star projection and compute the missing structural expansions of table types.
Inject the proper orderings into the RowNumber nodes produced earlier by the resolveFixJoins phase.
Flatten all Pure
node contents into a single StructNode
.
Ensure that all collection operations are wrapped in a Bind so that we have a place for expanding references later.
Lift applicable operations at the top level to the client side.
Infer all missing types.
A custom compiler for INSERT statements.
This phase merges nested nodes of types Bind, Filter, GroupBy, SortBy, Take, Drop, CollectionCast and Distinct to Comprehension nodes.
Optimize scalar expressions
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
Assign the AnonSymbols of fields from the left side of a Union to the right side.
Convert unreferenced StructNodes to single columns or ProductNodes (which is needed for aggregation functions and at the top level).
Remove all mapped types from the tree and store the original top-level type as the phase state to be used later for building the ResultSetMapping.
Replace all occurrences of Take
and Drop
with row number computations based on
zipWithIndex
operations.
Reorder certain stream operations for more efficient merging in mergeToComprehensions
.
Rewrite zip joins into a form suitable for SQL using inner joins and RowNumber columns.
For SQL back-ends which do not support real boolean types for fields and general expressions but which do have special boolean expressions and operators, this phase injects conversions between fake and real boolean values.
Rewrite "distinct on" to "distinct" or "group by"
Rewrite monadic joins to applicative joins.
Specialize the AST for edge cases of query parameters.
Verify that all monadic joins have been transformed into applicative joins and that the resulting tree does not contain references to unreachable symbols.
Optional phase which verifies that retyping the tree does not change any types.
The Phase
companion objects contains ready-to-use Phase
objects for
the standard phases of the query compiler
Slick AST to database query compiler