diff --git a/src/graph/executor/query/RollUpApplyExecutor.cpp b/src/graph/executor/query/RollUpApplyExecutor.cpp index 657df7ca5df..87c96c8e10d 100644 --- a/src/graph/executor/query/RollUpApplyExecutor.cpp +++ b/src/graph/executor/query/RollUpApplyExecutor.cpp @@ -142,17 +142,21 @@ folly::Future 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 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 hashTable; buildHashTable( diff --git a/tests/tck/features/match/PathExpr.feature b/tests/tck/features/match/PathExpr.feature index 078807c607d..0cb908646c5 100644 --- a/tests/tck/features/match/PathExpr.feature +++ b/tests/tck/features/match/PathExpr.feature @@ -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: