Commit 5e489fc
authored
feat: implement mapping evaluator with built-in functions (#45)
- Implement statement evaluator (eval.rs) supporting all 6 statement
types: rename, select, drop, set, default, cast
- Path resolution with nested field access, array indices, and wildcards
- Expression evaluation with operator precedence: arithmetic (+, -, *, /,
%), comparison (==, !=, >, >=, <, <=), logical (and, or, not)
- String concatenation via + operator with auto-coercion
- Type casting: int, float, string, bool with null handling
- Division/modulo by zero error detection
- Mixed int/float arithmetic with automatic promotion
- Truthiness semantics for all value types
- Implement 30+ built-in functions (functions.rs):
String: lower, upper, trim, trim_start, trim_end, len, replace,
contains, starts_with, ends_with, substr, concat, split, join, reverse
Type: to_int, to_float, to_string, to_bool, type_of
Math: abs, min, max, floor, ceil, round
Null: is_null, coalesce, default
- Function aliases: lowercase/downcase, uppercase/upcase, length/size,
ltrim/rtrim, substring, int/float/str/string/bool/typeof
- Add 110+ tests covering: all statement types with various inputs,
path resolution (nested, array, wildcard), expression evaluation,
function calls (direct and nested), type casting, error cases,
multi-statement pipelines, complex programs, edge cases
Fixes #171 parent b7a3524 commit 5e489fc
2 files changed
+1977
-2
lines changed
0 commit comments