linhongyu510 opened a new pull request, #2559: URL: https://github.com/apache/age/pull/2559
## Summary - remove `type(r) = "<label>"` when the same fixed-length relationship variable is already constrained by `MATCH ... [r:<label>]` - preserve all non-redundant predicates and avoid mutating the original `OPTIONAL MATCH` WHERE tree - add positive, negative, conjunction, disjunction, optional-match, variable-length, and variable-reuse regression coverage ## Correctness boundary The rewrite is intentionally conservative. It only handles a direct equality whose left side is `type(<single relationship variable>)` and whose right side is the exact static relationship label. It does not rewrite OR expressions, unlabeled relationships, variable-length relationships, mismatched labels, or ambiguous repeated bindings. ## Verification - RED on current `master`: the EXPLAIN regression failed because the `P` relationship scan still contained `_label_name(...) = "P"` - PostgreSQL 18.6 targeted regression: `expr`, `cypher_match`, and `cypher_vle` passed - PostgreSQL 18.6 full regression suite: 42/42 passed - build completed with GCC and LLVM bitcode generation ## Benchmark 20,000 `(:X)-[:P]->(:Y)` relationships, 12 alternating query pairs in an isolated PostgreSQL 18.6 container: | Revision | Plain typed MATCH median | Redundant `type(r)` median | Ratio | |---|---:|---:|---:| | current `master` | 2.854 ms | 4.622 ms | 1.620x | | this PR | 2.936 ms | 2.925 ms | 0.996x | All 24 measured queries returned `20000`. This demonstrates removal of the redundant runtime filter in this environment; it does not claim universal absolute latency. Closes #2481 Implementation and verification were AI-assisted. I reviewed the AST constraints, final diff, regression output, and benchmark results before submission. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
