Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Dec 26, 2022
1 parent c1194c5 commit e0b11d2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
6 changes: 5 additions & 1 deletion src/graph/visitor/PrunePropertiesVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,11 @@ void PrunePropertiesVisitor::visit(Unwind *node) {

void PrunePropertiesVisitor::visitCurrent(Unwind *node) {
const auto &alias = node->alias();
if (propsUsed_.hasAlias(alias)) {
auto expr = node->unwindExpr();
auto kind = expr->kind();
// unwind e.start_year as a
if (propsUsed_.hasAlias(alias) ||
(kind != Expression::Kind::kVarProperty && kind != Expression::Kind::kInputProperty)) {
status_ = extractPropsFromExpr(node->unwindExpr());
if (!status_.ok()) {
return;
Expand Down
43 changes: 21 additions & 22 deletions tests/tck/features/optimizer/PrunePropertiesRule.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@jmq
Feature: Prune Properties rule

# The schema id is not fixed in standalone cluster, so we skip it
Expand Down Expand Up @@ -549,27 +548,27 @@ Feature: Prune Properties rule
| "Spurs" | 11 |
| "Hornets" | 3 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 21 | Aggregate | 20 | |
| 20 | Aggregate | 19 | |
| 19 | HashLeftJoin | 10, 25 | |
| 10 | Aggregate | 23 | |
| 23 | Project | 22 | |
| 22 | Filter | 29 | |
| 29 | AppendVertices | 28 | { "props": "[{\"props\":[\"name\", \"_tag\"],\"tagId\": 4}]" } |
| 28 | Traverse | 27 | {"vertexProps": "[{\"props\":[\"name\", \"age\", \"_tag\"],\"tagId\": 3}, {\"props\":[\"name\", \"speciality\", \"_tag\"],\"tagId\": 5}, {\"props\":[\"name\", \"_tag\"],\"tagId\": 4}]", "edgeProps": "[{\"type\": 7, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 27 | Traverse | 26 | {"vertexProps": "", "edgeProps": "[{\"type\": -8, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 26 | Traverse | 2 | {"vertexProps": "", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}, {\"type\": 6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 2 | Dedup | 1 | |
| 1 | PassThrough | 3 | |
| 3 | Start | | |
| 25 | Project | 24 | |
| 24 | Filter | 16 | |
| 16 | AppendVertices | 15 | { "props": "[{\"props\":[\"name\", \"_tag\"],\"tagId\": 4}]" } |
| 15 | Traverse | 14 | {"vertexProps": "[{\"props\":[\"name\", \"age\", \"_tag\"],\"tagId\": 3}, {\"props\":[\"name\", \"speciality\", \"_tag\"],\"tagId\": 5}, {\"props\":[\"name\", \"_tag\"],\"tagId\": 4}]", "edgeProps": "[{\"type\": 7, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 14 | Traverse | 13 | {"vertexProps": "", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 13 | Traverse | 11 | {"vertexProps": "", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}, {\"type\": 6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 11 | Argument | | |
| id | name | dependencies | operator info |
| 21 | Aggregate | 20 | |
| 20 | Aggregate | 19 | |
| 19 | HashLeftJoin | 10, 25 | |
| 10 | Aggregate | 23 | |
| 23 | Project | 22 | |
| 22 | Filter | 29 | |
| 29 | AppendVertices | 28 | { "props": "[{\"tagId\":3,\"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"],\"tagId\":5},{\"tagId\":4,\"props\":[\"name\",\"_tag\"]}]" } |
| 28 | Traverse | 27 | {"vertexProps": "[{\"props\":[\"age\"],\"tagId\": 3}]", "edgeProps": "[{\"type\": 7, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 27 | Traverse | 26 | {"vertexProps": "", "edgeProps": "[{\"type\": -8, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 26 | Traverse | 2 | {"vertexProps": "[{\"tagId\":3,\"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"],\"tagId\":5},{\"tagId\":4,\"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}, {\"type\": 6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 2 | Dedup | 1 | |
| 1 | PassThrough | 3 | |
| 3 | Start | | |
| 25 | Project | 24 | |
| 24 | Filter | 16 | |
| 16 | AppendVertices | 15 | { "props": "[{\"tagId\":3,\"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"],\"tagId\":5},{\"tagId\":4,\"props\":[\"name\",\"_tag\"]}]"} |
| 15 | Traverse | 14 | {"vertexProps": "[{\"props\":[\"age\"],\"tagId\": 3}]", "edgeProps": "[{\"type\": 7, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 14 | Traverse | 13 | {"vertexProps": "", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 13 | Traverse | 11 | {"vertexProps": "[{\"tagId\":3,\"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"],\"tagId\":5},{\"tagId\":4,\"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{\"type\": -6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}, {\"type\": 6, \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } |
| 11 | Argument | | |

@distonly
Scenario: test properties:
Expand Down

0 comments on commit e0b11d2

Please sign in to comment.