feat: implement mapping evaluator with built-in functions#45
Merged
Conversation
- 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 #17
alvinreal
added a commit
that referenced
this pull request
Feb 21, 2026
- Replace single-arm match with if-let for modulo-by-zero check (clippy::single_match) - Remove redundant closure in join() (clippy::redundant_closure) - Replace 3.14 test values with 2.72 to avoid clippy::approx_constant (PI detection) Fixes CI failure introduced by #45.
alvinreal
added a commit
that referenced
this pull request
Feb 21, 2026
- Replace single-arm match with if-let for modulo-by-zero check (clippy::single_match) - Remove redundant closure in join() (clippy::redundant_closure) - Replace 3.14 test values with 2.72 to avoid clippy::approx_constant (PI detection) Fixes CI failure introduced by #45.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #17 — Mapping evaluator.
Part of #3 (Mapping DSL epic).
Changes
Evaluator (
src/mapping/eval.rs):+with auto-coercion to stringBuilt-in functions (
src/mapping/functions.rs) — 30+ functions:Tests (110+):
All checks pass:
cargo build,cargo test(575 tests),cargo fmt --check,cargo clippy -D warnings.