Skip to content

Commit

Permalink
Bug fix and refactored some other uses of "long"
Browse files Browse the repository at this point in the history
  • Loading branch information
CerielJacobs committed May 18, 2020
1 parent a9f1e3d commit 1a85b96
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions include/vlog/exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
struct _EDBPredicates {
PredId_t id;
size_t ruleid;
long triple[3];
int64_t triple[3];
uint8_t nPosToCopy;
uint8_t posToCopy[3];
};
Expand All @@ -24,8 +24,8 @@ class Exporter {
std::vector<uint64_t> &all_o,
std::vector<_EDBPredicates>::iterator it,
std::shared_ptr<const FCInternalTable> intTable,
const long nrows,
long triple[3]);
const int64_t nrows,
int64_t triple[3]);

public:
Exporter(std::shared_ptr<SemiNaiver> sn) : sn(sn) {}
Expand Down
2 changes: 1 addition & 1 deletion include/vlog/filterhashjoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct FilterHashJoinSorter {

bool operator() (const Term_t *r1, const Term_t *r2) const {
for (uint8_t i = 0; i < nfields; ++i) {
long diff = r1[fields[i]] - r2[fields[i]];
int64_t diff = r1[fields[i]] - r2[fields[i]];
if (diff < 0)
return true;
else if (diff > 0)
Expand Down
2 changes: 1 addition & 1 deletion include/vlog/seminaiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class SemiNaiver {

virtual FCIterator getTableFromEDBLayer(const Literal & literal);

virtual long getNLastDerivationsFromList();
virtual size_t getNLastDerivationsFromList();

virtual void saveDerivationIntoDerivationList(FCTable *endTable);

Expand Down
2 changes: 1 addition & 1 deletion include/vlog/seminaiver_threaded.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class SemiNaiverThreaded: public SemiNaiver {
}

protected:
long getNLastDerivationsFromList();
size_t getNLastDerivationsFromList();

void saveDerivationIntoDerivationList(FCTable *endTable);

Expand Down
12 changes: 6 additions & 6 deletions src/vlog/common/exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void Exporter::extractTriples(std::vector <uint64_t> &all_s,
}

//How many tuples should I store?
long count = 0;
int64_t count = 0;
for (auto it = predicatesToExtract.begin(); it != predicatesToExtract.end();
++it) {
count += sn->getSizeTable(it->id);
Expand All @@ -79,7 +79,7 @@ void Exporter::extractTriples(std::vector <uint64_t> &all_s,
++it) {
LOG(DEBUGL) << "Get table for pred " << it->id;
FCIterator tableItr = sn->getTable(it->id);
long triple[3];
int64_t triple[3];
triple[0] = it->triple[0];
triple[1] = it->triple[1];
triple[2] = it->triple[2];
Expand Down Expand Up @@ -254,7 +254,7 @@ ruleid++;
}
//How many tuples should I store?
long count = 0;
int64_t count = 0;
for (auto it = predicatesToExtract.begin(); it != predicatesToExtract.end();
++it) {
count += sn->getSizeTable(it->id);
Expand All @@ -271,7 +271,7 @@ for (auto it = predicatesToExtract.begin(); it != predicatesToExtract.end();
++it) {
LOG(DEBUGL) << "Get table for pred " << it->id;
FCIterator tableItr = sn->getTable(it->id);
long triple[3];
int64_t triple[3];
triple[0] = it->triple[0];
triple[1] = it->triple[1];
triple[2] = it->triple[2];
Expand Down Expand Up @@ -332,8 +332,8 @@ void Exporter::copyTable(std::vector<uint64_t> &all_s,
std::vector<uint64_t> &all_o,
std::vector<_EDBPredicates>::iterator it,
std::shared_ptr<const FCInternalTable> intTable,
const long nrows,
long triple[3]) {
const int64_t nrows,
int64_t triple[3]) {

uint8_t currentPosToCopy = 0;
for (int i = 0; i < 3; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/vlog/forward/segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ std::shared_ptr<const Segment> SegmentInserter::retain(
toRead2 = false;
}

long res = 0;
int64_t res = 0;
for (uint8_t i = 0; i < nPosToCompare; ++i) {
res = segmentIterator->get(posToCompare[i]) - itr2->getCurrentValue(i);
if (res != 0) {
Expand Down
12 changes: 6 additions & 6 deletions src/vlog/forward/seminaiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ bool SemiNaiver::executeRule(RuleExecutionDetails &ruleDetails,
return prodDer;
}

long SemiNaiver::getNLastDerivationsFromList() {
size_t SemiNaiver::getNLastDerivationsFromList() {
return listDerivations.back().table->getNRows();
}

Expand Down Expand Up @@ -1612,11 +1612,11 @@ SemiNaiver::~SemiNaiver() {
}

size_t SemiNaiver::countAllIDBs() {
long c = 0;
size_t c = 0;
for (PredId_t i = 0; i < program->getNPredicates(); ++i) {
if (predicatesTables[i] != NULL) {
if (program->isPredicateIDB(i)) {
long count = predicatesTables[i]->getNAllRows();
size_t count = predicatesTables[i]->getNAllRows();
c += count;
}
}
Expand Down Expand Up @@ -1646,7 +1646,7 @@ std::vector<std::pair<string, std::vector<StatsSizeIDB>>> SemiNaiver::getSizeIDB
out.push_back(std::make_pair(program->getPredicateName(i), stats));
}

//long count = predicatesTables[i]->getNAllRows();
//size_t count = predicatesTables[i]->getNAllRows();
//out.push_back(std::make_pair(program->getPredicateName(i), count));
}
}
Expand All @@ -1656,12 +1656,12 @@ std::vector<std::pair<string, std::vector<StatsSizeIDB>>> SemiNaiver::getSizeIDB
#endif

void SemiNaiver::printCountAllIDBs(std::string prefix) {
long c = 0;
size_t c = 0;
long emptyRel = 0;
for (PredId_t i = 0; i < program->getNPredicates(); ++i) {
if (predicatesTables[i] != NULL) {
if (program->isPredicateIDB(i)) {
long count = predicatesTables[i]->getNAllRows();
size_t count = predicatesTables[i]->getNAllRows();
if (count == 0) {
emptyRel++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vlog/forward/seminaiver_threaded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void SemiNaiverThreaded::saveDerivationIntoDerivationList(FCTable *endTable) {
SemiNaiver::saveDerivationIntoDerivationList(endTable);
}

long SemiNaiverThreaded::getNLastDerivationsFromList() {
size_t SemiNaiverThreaded::getNLastDerivationsFromList() {
std::lock_guard<std::mutex> lock(mutexListDer);
return SemiNaiver::getNLastDerivationsFromList();
}
Expand Down

0 comments on commit 1a85b96

Please sign in to comment.