Skip to main content

Module case_literal

Module case_literal 

Source
Expand description

Rewrites chains of If(Eq(expr, literal), result, If(...)) into CallVariadic { func: CaseLiteral { lookup, return_type }, exprs } for O(log n) evaluation via BTreeMap lookup.

Uses the ReprRelationType analysis to obtain column types in O(n), avoiding repeated input.typ() calls. Each scalar is then visited bottom-up so inner CaseLiterals are created first, then outer If nodes fold into them.

Structsยง

CaseLiteralTransform
Rewrites If-chains matching a single expression against literals into a CaseLiteral variadic function with BTreeMap lookup.