From 4ad5d2ff63a7dca117482aeb9361ec5c652e09f9 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Fri, 2 Dec 2022 18:41:04 +0800 Subject: [PATCH] Remove the pruning of kVarProperty and kInputProperty on count. --- src/graph/visitor/PropertyTrackerVisitor.cpp | 3 +-- .../tck/features/optimizer/PrunePropertiesRule.feature | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/graph/visitor/PropertyTrackerVisitor.cpp b/src/graph/visitor/PropertyTrackerVisitor.cpp index 293fa77ebe8..2829094f22a 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) { 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 |