Top-level IR node — represents the entire SQL statement structure.
The composition engine operates on this IR:
The main statement body as fragments
WITH clause CTEs in dependency order
Whether the original SQL started with a WITH clause
Whether the ORDER BY is legal in CTE context (TOP/OFFSET/FOR XML)
Trailing ORDER BY (if detected at top level)
Top-level IR node — represents the entire SQL statement structure.
The composition engine operates on this IR: