From ca0669424963765d08a63a29a0d89e27cf33ef51 Mon Sep 17 00:00:00 2001 From: Ceriel Jacobs Date: Thu, 29 Apr 2021 11:46:48 +0200 Subject: [PATCH] Addressing issue #72: an earlier fix (of issue #69) was partly wrong --- src/vlog/forward/joinprocessor.cpp | 2 +- src/vlog/forward/ruleexecplan.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/vlog/forward/joinprocessor.cpp b/src/vlog/forward/joinprocessor.cpp index d8d5367d..025332db 100644 --- a/src/vlog/forward/joinprocessor.cpp +++ b/src/vlog/forward/joinprocessor.cpp @@ -1289,8 +1289,8 @@ void JoinExecutor::mergejoin(const FCInternalTable * t1, SemiNaiver * naiver, idxInLiteral = r; break; } - nvars++; } + nvars++; } } // t.set(VTerm(0, bagValuesColumns[j][idxs[j]]), idxInLiteral); diff --git a/src/vlog/forward/ruleexecplan.cpp b/src/vlog/forward/ruleexecplan.cpp index 8ca4a78e..03b46187 100644 --- a/src/vlog/forward/ruleexecplan.cpp +++ b/src/vlog/forward/ruleexecplan.cpp @@ -137,7 +137,6 @@ void RuleExecutionPlan::calculateJoinsCoordinates(const std::vector &he std::vector> v2p; //Put in join coordinates between the previous and the current literal uint8_t litVars = 0; - uint8_t skipped = 0; std::set processed; // This set is used to avoid repeated variables in the literal. for (int x = 0; x < currentLiteral->getTupleSize(); ++x) { const VTerm t = currentLiteral->getTermAtPos(x); @@ -148,7 +147,7 @@ void RuleExecutionPlan::calculateJoinsCoordinates(const std::vector &he if (i != 0) { // i == 0 is a special case for the output coordinates (processRuleFirstAtom in // seminaiver.cpp). - skipped++; + litVars++; } continue; } @@ -185,7 +184,7 @@ void RuleExecutionPlan::calculateJoinsCoordinates(const std::vector &he // the variable number in the pattern. auto p = variablesNeededForHead.find(t.getId()); for(auto &el : p->second) { - ps.push_back(std::make_pair(el, litVars + skipped)); + ps.push_back(std::make_pair(el, litVars)); } } v2p.push_back(std::make_pair(x, newExistingVariables.size() + litVars)); @@ -195,7 +194,7 @@ void RuleExecutionPlan::calculateJoinsCoordinates(const std::vector &he if (iter2 != newExistingVariables.end()){ //found v2p.push_back(std::make_pair(x, (Var_t)(iter2 - newExistingVariables.begin()))); } else { - ps.push_back(std::make_pair(newExistingVariables.size(), litVars + skipped)); + ps.push_back(std::make_pair(newExistingVariables.size(), litVars)); v2p.push_back(std::make_pair(x, newExistingVariables.size())); newExistingVariables.push_back(t.getId()); LOG(TRACEL) << "New variable: " << (int) t.getId(); @@ -231,18 +230,18 @@ void RuleExecutionPlan::calculateJoinsCoordinates(const std::vector &he //Then search among the last literal if (!found) { - int litVars = 0; + int lv = 0; for (int x = 0; x < currentLiteral->getTupleSize(); ++x) { const VTerm t = currentLiteral->getTermAtPos(x); if (t.isVariable()) { if (t.getId() == v) { extvars2pos[pair.first].push_back( - existingVariables.size() + litVars); - LOG(TRACEL) << "Position = " << (int) (existingVariables.size() + litVars); + existingVariables.size() + lv); + LOG(TRACEL) << "Position = " << (int) (existingVariables.size() + lv); found = true; break; } - litVars++; + lv++; } } }