diff --git a/src/graph/visitor/PropertyTrackerVisitor.cpp b/src/graph/visitor/PropertyTrackerVisitor.cpp index 293fa77ebe8..d2d6dbcc2c4 100644 --- a/src/graph/visitor/PropertyTrackerVisitor.cpp +++ b/src/graph/visitor/PropertyTrackerVisitor.cpp @@ -317,8 +317,7 @@ void PropertyTrackerVisitor::visit(AggregateExpression *expr) { std::transform(funName.begin(), funName.end(), funName.begin(), ::tolower); if (funName == "count") { auto kind = expr->arg()->kind(); - if (kind == Expression::Kind::kConstant || kind == Expression::Kind::kInputProperty || - kind == Expression::Kind::kVarProperty) { + if (kind == Expression::Kind::kConstant || kind == Expression::Kind::kInputProperty) { return; } } diff --git a/tests/tck/features/optimizer/PrunePropertiesRule.feature b/tests/tck/features/optimizer/PrunePropertiesRule.feature index 85b906f7bb3..d17d6df6a40 100644 --- a/tests/tck/features/optimizer/PrunePropertiesRule.feature +++ b/tests/tck/features/optimizer/PrunePropertiesRule.feature @@ -878,3 +878,13 @@ Feature: Prune Properties rule | v.player.name | t.errortag.name | properties(v) | t | | "Tim Duncan" | __NULL__ | {age: 42, name: "Tim Duncan", speciality: "psychology"} | ("Tony Parker" :player{age: 36, name: "Tony Parker"}) | | "Tim Duncan" | __NULL__ | {age: 42, name: "Tim Duncan", speciality: "psychology"} | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) | + + Scenario: no pruning on agg after unwind + Given a graph with space named "nba" + When executing query: + """ + match (v0:player)-[e0]->(v1) where id(v0) == "Tim Duncan" unwind e0.start_year as a return count(a) + """ + Then the result should be, in any order: + | count(a) | + | 5 |