Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfengHKU committed Mar 10, 2023
1 parent 05bd4af commit 4b65e23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/optimizer/asp_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ void ASPOptimizer::visitHashJoin(planner::LogicalOperator* op) {
// Probe side is not selective so we don't apply ASP.
return;
}
auto scanNodes = resolveScanNodesToApplySemiMask(op);
if (scanNodes.empty()) {
return;
}
// apply ASP
hashJoin->setInfoPassing(planner::HashJoinSideWayInfoPassing::LEFT_TO_RIGHT);
auto currentChild = op->getChild(0);
for (auto& op_ : resolveScanNodesToApplySemiMask(op)) {
for (auto& op_ : scanNodes) {
auto scanNode = (LogicalScanNode*)op_;
auto semiMasker = std::make_shared<LogicalSemiMasker>(scanNode, currentChild);
semiMasker->computeFlatSchema();
Expand Down
15 changes: 10 additions & 5 deletions test/test_files/tinysnb/asp/asp.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ Bob
Dan

-NAME AspMultiKey
-QUERY MATCH (a:person)-[e1:knows]->(b:person)-[e2:knows]->(c:person), (a)-[e3:knows]->(c) WHERE a.fName='Alice' AND e1.meetTime=timestamp('1986-10-21 21:08:31.521') RETURN b.fName, c.fName
-ENCODED_JOIN HJ(c._id,b._id){E(b)E(c)S(a)}{HJ(b._id){S(b)}{E(b)S(c)}}
-PARALLELISM 1
---- 2
-QUERY MATCH (a:person)-[e1:knows]->(b:person)-[e2:knows]->(c:person), (a)-[e3:knows]->(c) WHERE a.fName='Alice' RETURN b.fName, c.fName
#-ENCODED_JOIN HJ(c._id,b._id){E(b)E(c)S(a)}{HJ(b._id){S(b)}{E(b)S(c)}}
-ENUMERATE
---- 6
Bob|Carol
Bob|Dan
Carol|Bob
Carol|Dan
Dan|Bob
Dan|Carol

-NAME AspMultiMaskToOneScan
-QUERY MATCH (a:person)<-[e1:knows]-(b:person)-[e2:knows]->(c:person) WHERE a.fName='Alice' AND c.fName='Bob' RETURN b.fName
-ENCODED_JOIN HJ(b._id){E(b)S(a)}{HJ(b._id){E(b)S(c)}{S(b)}}
#-ENCODED_JOIN HJ(b._id){E(b)S(a)}{HJ(b._id){E(b)S(c)}{S(b)}}
-ENUMERATE
---- 2
Carol
Dan

0 comments on commit 4b65e23

Please sign in to comment.