The immutable state of the phase that can also be accessed by other phases.
The immutable state of the phase that can also be accessed by other phases.
Run the phase
Run the phase
Create a select for a Comprehension without one.
Rewrite a Comprehension to always return a StructNode
Remove constant GROUP BY criteria.
Remove constant GROUP BY criteria. Not all databases support them and they never make sense. We filter all constant columns out of the grouping criteria. If any non-constant columns are left, they are kept as the new criteria, otherwise the GROUP BY clause is removed entirely. Since all column references to non-criteria columns can only be used with aggregation functions, this automatically turns the query into an aggregating query.
Fuse simple Comprehensions (no orderBy, fetch or offset), which are contained in the 'from' list of another Comprehension, into their parent.
Check if two comprehensions can be fused (assuming the outer and inner comprehension have already been deemed fuseable on their own).
Check if a Comprehension should be fused into its parent.
Check if a Comprehension should be fused into its parent. This happens in the following cases: - It has a Pure generator. - It does not have any generators. - The Comprehension has a 'select' clause which consists only of Paths, constant values and client-side type conversions. - It refers to a symbol introduced in a previous FROM clause of an outer Comprehension.
Check if a comprehension allow sub-comprehensions to be fused.
Check if a comprehension allow sub-comprehensions to be fused. This is the case if it has a select clause and not more than one sub-comprehension with a groupBy clause.
Lift aggregates of sub-queries into the 'from' list or inline them (if they would refer to unreachable symbols when used in 'from' position).
The unique name of the phase
The unique name of the phase
Fuse sub-comprehensions into their parents.