Expand Rust AEL fast path with native control lowering#2
Open
HeshamHM28 wants to merge 3 commits into
Open
Conversation
Add a PyO3-backed Rust subset parser for AEL, wire it into parse_ael as an optional fast path with safe fallback to the existing ANTLR parser, add focused regression tests, and include a standalone parser benchmark tool outside benchmarks/.
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.
Impact
750/750valid repo-corpus expressions supported,596/596literalparse_ael(...)callsites supported,0mismatches.4,798.6612,988.762.71x208.3976.99parse_ael(...)callsites4,496.229,842.602.19x222.41101.60121-131 usper dynamically parsed AEL expression.RU,50benchmark stays roughly flat, which is expected: this change speeds up client-side parsing, not Aerospike network/server I/O.Where this helps
This optimization applies to the client-side AEL parse path:
parse_ael("...")calls.where("...")on async and sync query builders.where("...")on background/update/delete/UDF builders that accept AEL stringsThe biggest newly-native cases in this PR are:
let(...)when(...)${var}references and variable definitionsSummary
This PR extends the optional Rust AEL fast path so
let(...),when(...), variable references, and variable definitions are lowered natively instead of bouncing back through the Python visitor.It also keeps broader expression shapes on the Rust path, including operand casts, bitwise expressions, generic functions, and the expanded CDT-path coverage already added on this branch.
Validation
cargo test --manifest-path rust/ael_rust_ext/Cargo.toml --target-dir /tmp/ael_rust_ext-target:5 passedpytest tests/unit -q:1581 passedpytest tests/integration -q:979 passed, 37 skipped, 2 xfailedRepo corpus scan details:
868expressions total11828placeholder-only cases with no values supplied,90expressions Python itself rejects0Benchmarks
Note
I also validated a local CI wiring change that builds the Rust extension in the Python
3.12unit/integration lanes, but I could not include.github/workflows/build-test.ymlin the pushed branch because the GitHub token available in this environment lacksworkflowscope for fork pushes.