Expand description
Shared AST manipulation helpers for DML planners.
Functions§
- find_
foreign_ qualifier - Walk
exprand return the first qualifier on atable.colcompound identifier that does not match any ofvalid_qualifiers. Used by the single-table WHERE planner to reject a table qualifier that refers to neither the table’s name nor its alias (e.g.WHERE wrong.name = ...) with a typed error, instead of silently stripping it into a bare field lookup that would never match any row. - flatten_
and_ expr - Flatten a right-leaning AND expression tree into a list of conjuncts.
- qualified_
ident_ pair - Return
(table, column)for atable.colcompound identifier, orNone. - rebuild_
and_ expr - Reassemble conjuncts into a right-leaning AND tree. Panics if empty.
- strip_
and_ convert_ filters - Strip
qualifier.from all compound identifiers inexpr, then convert the result toVec<Filter>viaconvert_where_to_filters. - strip_
single_ table_ qualifiers - Normalize a SINGLE-TABLE
SELECTby stripping the (always-redundant) table qualifier from column refs in the projection, WHERE, and GROUP BY, returning a rewritten copy.t.col/alias.colcollapse tocolbefore the qualified name can become a literal"t.col"field-lookup string that no stored document ever has (silent zero-row / empty-value bug). A qualifier that matches neither the table’s name nor its alias is a typed error, never a silent match-nothing. Subquery bodies are intentionally not descended into (their qualifiers belong to their own tables). - strip_
table_ qualifier - Walk an expression and replace every
table.colcompound identifier wheretable == qualifierwith a barecolidentifier. Lets target-side predicates liket.score > 15be evaluated against documents that store fields without a table qualifier.