Skip to content

Commit

Permalink
Addressing issue #55 and issue #73
Browse files Browse the repository at this point in the history
  • Loading branch information
CerielJacobs committed Jul 7, 2021
1 parent ea4d407 commit de26ce6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/vlog/common/edb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <vlog/incremental/edb-table-importer.h>

#include <climits>

#include <inttypes.h>

EDBLayer::EDBLayer(EDBLayer &db, bool copyTables) : conf(db.conf) {
this->predDictionary = db.predDictionary;
Expand Down Expand Up @@ -1011,12 +1011,16 @@ std::shared_ptr<Column> EDBLayer::checkIn(

bool EDBLayer::getDictNumber(const char *text, const size_t sizeText, uint64_t &id) const {
bool resp = false;
size_t sz = sizeText;
if (sz > 43 && text[0] == '"' && ! strcmp(text + sz - 43, "^^<http://www.w3.org/2001/XMLSchema#string>")) {
sz -= 43;
}
if (dbPredicates.size() > 0) {
resp = dbPredicates.begin()->second.manager->
getDictNumber(text, sizeText, id);
getDictNumber(text, sz, id);
}
if (!resp && termsDictionary.get()) {
std::string t(text, sizeText);
std::string t(text, sz);
resp = termsDictionary->get(t, id);
}
return resp;
Expand All @@ -1025,17 +1029,21 @@ bool EDBLayer::getDictNumber(const char *text, const size_t sizeText, uint64_t &
bool EDBLayer::getOrAddDictNumber(const char *text, const size_t sizeText,
uint64_t &id) {
bool resp = false;
size_t sz = sizeText;
if (sz > 43 && text[0] == '"' && ! strcmp(text + sz - 43, "^^<http://www.w3.org/2001/XMLSchema#string>")) {
sz -= 43;
}
if (dbPredicates.size() > 0) {
resp = dbPredicates.begin()->second.manager->
getDictNumber(text, sizeText, id);
getDictNumber(text, sz, id);
}
if (!resp) {
if (!termsDictionary.get()) {
LOG(DEBUGL) << "The additional terms will start from " << getNTerms();
termsDictionary = std::shared_ptr<Dictionary>(
new Dictionary(getNTerms()));
}
std::string t(text, sizeText);
std::string t(text, sz);
id = termsDictionary->getOrAdd(t);
LOG(TRACEL) << "getOrAddDictNumber \"" << t << "\" returns " << id;
resp = true;
Expand All @@ -1047,7 +1055,7 @@ bool EDBLayer::getDictText(const uint64_t id, char *text) const {
if (IS_NUMBER(id)) {
if (IS_UINT(id)) {
uint64_t value = GET_UINT(id);
sprintf(text,"%llu",value);
sprintf(text,"%" PRIu64,value);
return true;
} else if (IS_FLOAT32(id)) {
float value = GET_FLOAT32(id);
Expand Down
2 changes: 2 additions & 0 deletions src/vlog/inmemory/inmemorytable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ std::string convertString(const char *s, int len) {

std::string ss = std::string(s, s+len);

/*
if (len > 1 && s[0] == '"' && s[len-1] == '"') {
return (ss + "^^<http://www.w3.org/2001/XMLSchema#string>").c_str();
}
*/
return ss;
}

Expand Down

0 comments on commit de26ce6

Please sign in to comment.