yggdrasil.execution.expr.backends.polars_backend¶
polars_backend ¶
polars.Expr emitter + best-effort lifter.
:func:to_polars translates the AST to a :class:polars.Expr —
suitable as the predicate of :meth:polars.DataFrame.filter /
:meth:polars.LazyFrame.filter. Output uses native polars
operators so optimization (predicate pushdown, projection
pruning) kicks in.
:func:from_polars parses a polars expression's serialized form
back into our AST. Polars exposes Expr.meta.serialize() /
Expr.meta.tree_format() for introspection — the lifter walks
the tree-format output. Anything beyond comparisons + boolean
combinators raises :class:NotImplementedError.
from_polars ¶
Lift a :class:polars.Expr back into our AST.
Uses Expr.meta.serialize(format="json") (polars ≥ 0.20).
Older polars versions raise :class:NotImplementedError —
upgrade or carry the original :class:Expression through the
pipeline.