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 #4778

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions src/graph/executor/query/RollUpApplyExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,21 @@ folly::Future<Status> RollUpApplyExecutor::rollUpApply() {
NG_RETURN_IF_ERROR(checkBiInputDataSets());
DataSet result;
mv_ = movable(node()->inputVars()[0]);

if (rollUpApplyNode->compareCols().size() == 0) {
List hashTable;
buildZeroKeyHashTable(rollUpApplyNode->collectCol(), rhsIter_.get(), hashTable);
result = probeZeroKey(lhsIter_.get(), hashTable);
} else if (rollUpApplyNode->compareCols().size() == 1) {
std::unordered_map<Value, List> hashTable;
buildSingleKeyHashTable(rollUpApplyNode->compareCols()[0],
// Clone the expression so when evaluating the InputPropertyExpression, the propIndex_ will not
// be buffered.
buildSingleKeyHashTable(rollUpApplyNode->compareCols()[0]->clone(),
rollUpApplyNode->collectCol(),
rhsIter_.get(),
hashTable);
result = probeSingleKey(rollUpApplyNode->compareCols()[0], lhsIter_.get(), hashTable);

result = probeSingleKey(rollUpApplyNode->compareCols()[0]->clone(), lhsIter_.get(), hashTable);
} else {
std::unordered_map<List, List> hashTable;
buildHashTable(
Expand Down
10 changes: 10 additions & 0 deletions tests/tck/features/match/PathExpr.feature
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ Feature: Basic match
| name |
| "Tim Duncan" |
| "Tim Duncan" |
When executing query:
"""
MATCH (v:player{name:"Tim Duncan"})<-[:like]-(v2) WHERE NOT (v2)<-[:like]-() RETURN v2;
"""
Then the result should be, in any order:
| v2 |
| ("Dejounte Murray" :player{age: 29, name: "Dejounte Murray"}) |
| ("Aron Baynes" :player{age: 32, name: "Aron Baynes"}) |
| ("Tiago Splitter" :player{age: 34, name: "Tiago Splitter"}) |
| ("Boris Diaw" :player{age: 36, name: "Boris Diaw"}) |

Scenario: In With
When executing query:
Expand Down