diff --git a/src/graph/optimizer/rule/EmbedEdgeAllPredIntoTraverseRule.cpp b/src/graph/optimizer/rule/EmbedEdgeAllPredIntoTraverseRule.cpp index 1a58da9c0b9..d66bd1d5d77 100644 --- a/src/graph/optimizer/rule/EmbedEdgeAllPredIntoTraverseRule.cpp +++ b/src/graph/optimizer/rule/EmbedEdgeAllPredIntoTraverseRule.cpp @@ -65,6 +65,10 @@ bool isEdgeAllPredicate(const Expression* e, return false; } auto ves = graph::ExpressionUtils::collectAll(pe->filter(), {Expression::Kind::kAttribute}); + if (ves.empty()) { + // innerVar.prop not exists + return false; + } for (const auto& ve : ves) { auto iv = static_cast(ve)->left(); diff --git a/tests/tck/features/match/MultiLineMultiQueryParts.feature b/tests/tck/features/match/MultiLineMultiQueryParts.feature index 1f0030c2831..60b1163777e 100644 --- a/tests/tck/features/match/MultiLineMultiQueryParts.feature +++ b/tests/tck/features/match/MultiLineMultiQueryParts.feature @@ -298,6 +298,17 @@ Feature: Multi Line Multi Query Parts Then the result should be, in order: | scount | lcount | | 19 | 110 | + When executing query: + """ + MATCH (m:player{name:"Tim Duncan"})-[e:like*2..3]-(n)--() + WHERE all(i in e where rank(i)==0) + WITH m,count(*) AS lcount + MATCH (m)--(n) + RETURN count(*) AS scount, lcount + """ + Then the result should be, in order: + | scount | lcount | + | 19 | 2888 | When executing query: """ MATCH (m:player{name:"Tim Duncan"})-[:like]-(n)--()