Skip to content

Commit

Permalink
Remove the pruning of kVarProperty and kInputProperty on count.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Dec 6, 2022
1 parent 81feb43 commit 4ad5d2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/graph/visitor/PropertyTrackerVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
10 changes: 10 additions & 0 deletions tests/tck/features/optimizer/PrunePropertiesRule.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

0 comments on commit 4ad5d2f

Please sign in to comment.