Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong output when using pattern expression as the filter in MATCH #4788

Merged
merged 3 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/expression/UnaryExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class UnaryExpression final : public Expression {
void resetFrom(Decoder& decoder) override;

private:
Expression* operand_;
Expression* operand_{nullptr};
Value result_;
};

Expand Down
7 changes: 5 additions & 2 deletions src/graph/executor/query/RollUpApplyExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ DataSet RollUpApplyExecutor::probe(std::vector<Expression*> probeKeys,
List list;
list.values.reserve(probeKeys.size());
for (auto& col : probeKeys) {
Value val = col->eval(ctx(probeIter));
// Clone the expression so when evaluating the InputPropertyExpression, the propIndex_ will
Aiee marked this conversation as resolved.
Show resolved Hide resolved
// not be cached
auto* colCopy = col->clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header of input table is fixed, why propIndex_ will be incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, the column t is the 3rd column in the left iterator and is the 2nd column in the right iterator.

I20221026 16:00:58.585834 2228773 RollUpApplyExecutor.cpp:39] left iter size: 7
I20221026 16:00:58.585844 2228773 RollUpApplyExecutor.cpp:40] left iter value: v|e|t|p|

I20221026 16:00:58.586164 2228773 RollUpApplyExecutor.cpp:42] right iter size: 6
I20221026 16:00:58.586175 2228773 RollUpApplyExecutor.cpp:43] right iter value: v|t|(v)-->(t:player)|

Value val = colCopy->eval(ctx(probeIter));
list.values.emplace_back(std::move(val));
}

Expand Down Expand Up @@ -150,7 +153,7 @@ folly::Future<Status> RollUpApplyExecutor::rollUpApply() {
} else if (rollUpApplyNode->compareCols().size() == 1) {
std::unordered_map<Value, List> hashTable;
// Clone the expression so when evaluating the InputPropertyExpression, the propIndex_ will not
// be buffered.
// be cached.
buildSingleKeyHashTable(rollUpApplyNode->compareCols()[0]->clone(),
rollUpApplyNode->collectCol(),
rhsIter_.get(),
Expand Down
7 changes: 7 additions & 0 deletions tests/tck/features/match/PathExpr.feature
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ Feature: Basic match
| ("Aron Baynes" :player{age: 32, name: "Aron Baynes"}) |
| ("Tiago Splitter" :player{age: 34, name: "Tiago Splitter"}) |
| ("Boris Diaw" :player{age: 36, name: "Boris Diaw"}) |
When executing query:
"""
MATCH p = (v:player{name:"Tim Duncan"})-[e]->(t) WHERE NOT (v)-[]->(t:player) RETURN t
"""
Then the result should be, in any order:
| t |
| ("Spurs" :team{name: "Spurs"}) |

Scenario: In With
When executing query:
Expand Down