Skip to content

Commit

Permalink
I think I've got it.
Browse files Browse the repository at this point in the history
But we still have to clean up a lot of stuff.
  • Loading branch information
joka921 committed Jan 12, 2024
1 parent a2e0265 commit c79d25f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions src/engine/idTable/CompressedExternalIdTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class CompressedExternalIdTableBase {
AD_CONTRACT_CHECK(NumStaticCols == 0 || NumStaticCols == numCols);
}
// TODO<joka921> Shouldn't be public.
std::atomic<bool> isFirstMerge = true;
std::atomic<bool> isFirstMerge = true;
// Add a single row to the input. The type of `row` needs to be something that
// can be `push_back`ed to a `IdTable`.
void push(const auto& row) requires requires { currentBlock_.push_back(row); }
Expand Down Expand Up @@ -417,7 +417,7 @@ class CompressedExternalIdTableBase {
if (numBlocksPushed_ == 0) {
AD_CORRECTNESS_CHECK(this->numElementsPushed_ ==
this->currentBlock_.size());
blockTransformation_(this->currentBlock_);
blockTransformation_(this->currentBlock_);
return false;
}
pushBlock(std::move(this->currentBlock_));
Expand Down Expand Up @@ -645,10 +645,12 @@ class CompressedExternalIdTableSorter
const auto& block = this->currentBlock_;
const auto blocksizeOutput = blocksize.value_or(block.numRows());
if (block.numRows() <= blocksizeOutput) {
// TODO<joka921> We don't need the copy if we only want to iterate once, make this configurable.
auto blockAsStatic = IdTableStatic<N>(this->currentBlock_.clone().template toStatic<N>());
// TODO<joka921> We don't need the copy if we only want to iterate once,
// make this configurable.
auto blockAsStatic = IdTableStatic<N>(
this->currentBlock_.clone().template toStatic<N>());
co_yield blockAsStatic;
//co_yield std::move(this->currentBlock_).template toStatic<N>();
// co_yield std::move(this->currentBlock_).template toStatic<N>();
} else {
for (size_t i = 0; i < block.numRows(); i += blocksizeOutput) {
size_t upper = std::min(i + blocksizeOutput, block.numRows());
Expand Down Expand Up @@ -764,4 +766,4 @@ class CompressedExternalIdTableSorter
};
} // namespace ad_utility

#endif // QLEVER_COMPRESSEDEXTERNALIDTABLE_H
#endif // QLEVER_COMPRESSEDEXTERNALIDTABLE_H
4 changes: 2 additions & 2 deletions src/index/IndexImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ void IndexImpl::createFromOnDiskIndex(const string& onDiskBase) {
totalVocabularySize_ = vocab_.size() + vocab_.getExternalVocab().size();
LOG(DEBUG) << "Number of words in internal and external vocabulary: "
<< totalVocabularySize_ << std::endl;
pso_.loadFromDisk(onDiskBase_, false, usePatterns());
pos_.loadFromDisk(onDiskBase_, false, usePatterns());
pso_.loadFromDisk(onDiskBase_, false, !usePatterns());
pos_.loadFromDisk(onDiskBase_, false, !usePatterns());

if (loadAllPermutations_) {
ops_.loadFromDisk(onDiskBase_);
Expand Down
3 changes: 2 additions & 1 deletion src/index/Permutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Permutation::Permutation(Enum permutation, Allocator allocator,

// _____________________________________________________________________
void Permutation::loadFromDisk(const std::string& onDiskBase,
bool onlyLoadAdditional, bool dontLoadAdditional) {
bool onlyLoadAdditional,
bool dontLoadAdditional) {
if (!onlyLoadAdditional) {
if constexpr (MetaData::_isMmapBased) {
meta_.setup(onDiskBase + ".index" + fileSuffix_ + MMAP_FILE_SUFFIX,
Expand Down
3 changes: 2 additions & 1 deletion src/index/Permutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class Permutation {
// everything that has to be done when reading an index from disk
// TODO<joka921> Why do we need the second argument.
void loadFromDisk(const std::string& onDiskBase,
bool onlyLoadAdditional = false, bool dontLoadAdditional = false);
bool onlyLoadAdditional = false,
bool dontLoadAdditional = false);

// For a given ID for the col0, retrieve all IDs of the col1 and col2.
// If `col1Id` is specified, only the col2 is returned for triples that
Expand Down
2 changes: 1 addition & 1 deletion test/HasPredicateScanTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ TEST(CountAvailablePredicates, patternTrickTest) {
ASSERT_EQ(Int(3u), result[4][1]);
}

#endif
#endif
2 changes: 1 addition & 1 deletion test/IndexTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ TEST(CreatePatterns, createPatterns) {
"<a2> <d> <c2> .";

const Index& indexNoImpl = getQec(kb)->getIndex();
//const IndexImpl& index = indexNoImpl.getImpl();
// const IndexImpl& index = indexNoImpl.getImpl();

auto getId = ad_utility::testing::makeGetId(indexNoImpl);
// Pattern p0 (for subject <a>) consists of <b> and <b2)
Expand Down

0 comments on commit c79d25f

Please sign in to comment.