Summary
Direct-Cypher WHERE clauses with conjoined pattern predicates can produce different results depending on operand order when variable-length predicates are involved.
Repro (minimal)
Using a graph with:
- REL1 chain:
a->b->c->d
- REL2 edges:
a->e, b->e
Query A:
MATCH (n)
WHERE (n)-[:REL1*2]->() AND (n)-[:REL2*1]->()
RETURN n.id AS id ORDER BY id
Observed: [{"id": "b"}]
Query B (same operands swapped):
MATCH (n)
WHERE (n)-[:REL2*1]->() AND (n)-[:REL1*2]->()
RETURN n.id AS id ORDER BY id
Observed: []
Expected
AND should be order-invariant for logically equivalent predicates.
Context
Initial hypothesis
Lowering/evaluation for where-pattern rewrites may be order-sensitive when mixing multiple pattern predicates, likely around semi-apply marker/filter sequencing.
Summary
Direct-Cypher
WHEREclauses with conjoined pattern predicates can produce different results depending on operand order when variable-length predicates are involved.Repro (minimal)
Using a graph with:
a->b->c->da->e,b->eQuery A:
Observed:
[{"id": "b"}]Query B (same operands swapped):
Observed:
[]Expected
ANDshould be order-invariant for logically equivalent predicates.Context
WHEREpattern support.Initial hypothesis
Lowering/evaluation for where-pattern rewrites may be order-sensitive when mixing multiple pattern predicates, likely around semi-apply marker/filter sequencing.