Skip to content

Commit

Permalink
Bug fix for negated IDB literal for which there is no rule
Browse files Browse the repository at this point in the history
  • Loading branch information
CerielJacobs committed Apr 15, 2019
1 parent f73b1c8 commit a2d4e40
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/vlog/forward/joinprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2290,11 +2290,9 @@ void JoinExecutor::leftjoin(const FCInternalTable * t1, SemiNaiver * naiver,
it.moveNextCount();
}

if (tablesToLeftJoin.size() > 0){
LOG(TRACEL) << "CALLING JoinExecutor::left_join";
JoinExecutor::left_join(t1, fields1, tablesToLeftJoin, fields1, NULL, NULL,
fields2, output, nthreads);
}
LOG(TRACEL) << "CALLING JoinExecutor::left_join";
JoinExecutor::left_join(t1, fields1, tablesToLeftJoin, fields1, NULL, NULL,
fields2, output, nthreads);
LOG(TRACEL) << "ENDING JoinExecutor::leftjoin";
}

Expand All @@ -2313,11 +2311,6 @@ void JoinExecutor::left_join(const FCInternalTable * filteredT1,
int processedTables = 0;
bool first = true;

//L. Check this
if (tables2.size() == 0) {
return;
}

std::chrono::system_clock::time_point startS;
std::chrono::duration<double> secS;
size_t totalsize2 = 0;
Expand All @@ -2342,6 +2335,16 @@ void JoinExecutor::left_join(const FCInternalTable * filteredT1,

Output *out = new Output(output, NULL);

if (tables2.size() == 0) {
std::vector<const std::vector<Term_t> *> vectors2;
std::vector<uint8_t> dummyFields;
JoinExecutor::do_left_join(vectors1, vectors2, dummyFields, dummyFields, out);
sortedItr1->deleteAllVectors(vectors1);
filteredT1->releaseIterator(sortedItr1);
delete out;
return;
}

LOG(TRACEL) << "Main loop of left_join";
auto t2 = tables2[0];
processedTables++;
Expand Down Expand Up @@ -2416,7 +2419,7 @@ void JoinExecutor::do_left_join(
size_t l1 = 0;
size_t l2 = 0;
size_t u1 = vectors1[0]->size();
size_t u2 = vectors2[0]->size();
size_t u2 = vectors2.size() > 0 ? vectors2[0]->size() : 0;

//Special case. There is no left join
if (fields1.size() == 0 && l1 < u1 && l2 < u2) {
Expand Down
3 changes: 3 additions & 0 deletions src/vlog/forward/seminaiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,9 @@ size_t SemiNaiver::estimateCardTable(const Literal &literal,

PredId_t id = literal.getPredicate().getId();
FCTable *table = predicatesTables[id];
if (literal.isNegated()) {
return 1;
}
if (table == NULL || table->isEmpty() ||
table->getMaxIteration() < minIteration ||
table->getMinIteration() > maxIteration) {
Expand Down

0 comments on commit a2d4e40

Please sign in to comment.