Expand description
A lookup-based evaluation of CASE expr WHEN lit1 THEN res1 ... ELSE els END.
CaseLiteral replaces chains of If(Eq(expr, literal), result, If(...))
with a sorted Vec + binary-search lookup, turning O(n) evaluation into O(log n).
Represented as a CallVariadic { func: CaseLiteral { lookup, return_type }, exprs }
where:
exprs[0]= input expression (thexinCASE x WHEN ...)exprs[1..n]= case result expressionsexprs[last]=els(fallback)lookup: Vec<CaseLiteralEntry>maps literal values to indices inexprs(sorted byRow)
Structsยง
- Case
Literal - Evaluates a CASE expression by looking up the input datum in a sorted
Vec. - Case
Literal Entry - A single entry in a
CaseLiterallookup table: a literalRowvalue paired with the index of the corresponding result expression inexprs.