Skip to content

Commit

Permalink
Parse folded POINT geometries from QLever IDs dynamically (#19)
Browse files Browse the repository at this point in the history
* Parse the folded points from the qlever IDs of the query result and ignore POINTs during geometry filling

* Don't cache query if "rand()" is contained in lowercased query

* Change "geometries" to "objects" in loading message, "geometries" was misleading
  • Loading branch information
patrickbr authored Oct 17, 2024
1 parent 7ea149b commit fd692f8
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 77 deletions.
28 changes: 16 additions & 12 deletions src/qlever-petrimaps/GeomCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,18 @@ void GeomCache::parse(const char *c, size_t size) {
sizeof(IdMapping));
_qidToIdFSize++;
} else if ((p = _dangling.rfind("POINT(", 1)) != std::string::npos) {
_curUniqueGeom++;
size_t i = 0;
p = parseMultiPoint(_dangling, p + 4, std::string::npos, &i);

// dummy element to keep sync
if (i == 0) {
IdMapping idm{0, std::numeric_limits<ID_TYPE>::max()};
_lastQidToId = idm;
_qidToIdF.write(reinterpret_cast<const char *>(&idm),
sizeof(IdMapping));
_qidToIdFSize++;
}
// _curUniqueGeom++;
// size_t i = 0;
// p = parseMultiPoint(_dangling, p + 4, std::string::npos, &i);

// // dummy element to keep sync
// if (i == 0) {
// IdMapping idm{0, std::numeric_limits<ID_TYPE>::max()};
// _lastQidToId = idm;
// _qidToIdF.write(reinterpret_cast<const char *>(&idm),
// sizeof(IdMapping));
// _qidToIdFSize++;
// }
} else if ((p = _dangling.rfind("MULTIPOINT(", 1)) !=
std::string::npos) {
_curUniqueGeom++;
Expand Down Expand Up @@ -409,6 +409,10 @@ void GeomCache::parseIds(const char *c, size_t size) {
<< " points), " << _geometryDuplicates << " duplicates)";
}

uint8_t type = (_curId.val & (uint64_t(15) << 60)) >> 60;

if (type == 8) continue;

if (_curIdRow < _qidToId.size() && _qidToId[_curIdRow].qid == 0) {
// if we have two consecutive and equivalent QLever ids, the geometry
// was returned multiple times in the fill query. This can happen if the
Expand Down
Loading

0 comments on commit fd692f8

Please sign in to comment.