Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply binary search filter expressions directly on the block metadata of Index Scans #1619

Merged
Merged
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
99da434
Added conversion str to int
realHannes Apr 25, 2024
424d023
templated function for toNumeric, add declaration to NaryExpression.h
realHannes Apr 25, 2024
0117e82
str to num for SparqlExpression implemented + added test
realHannes Apr 25, 2024
35fd0b1
Merge branch 'ad-freiburg:master' into master
realHannes Apr 26, 2024
94356c2
Update src/engine/sparqlExpressions/StringExpressions.cpp
realHannes Apr 26, 2024
decc8ba
Update src/engine/sparqlExpressions/StringExpressions.cpp
realHannes Apr 26, 2024
850152c
Update src/engine/sparqlExpressions/StringExpressions.cpp
realHannes Apr 26, 2024
d650d67
Update src/engine/sparqlExpressions/StringExpressions.cpp
realHannes Apr 26, 2024
46cc697
using now absl::from_chars() and stripping whitespaces for string to …
realHannes Apr 26, 2024
7fc5c28
added new functions to processIriFuntionCall() (for string to number)
realHannes Apr 26, 2024
efb0e24
renaming to: toIntExpression and toDoubleExpression for later more ge…
realHannes Apr 26, 2024
a88537c
made format (clang-format-16)
realHannes Apr 26, 2024
ca1e2e0
Update src/parser/sparqlParser/SparqlQleverVisitor.cpp
realHannes Apr 29, 2024
4adc831
Update src/parser/sparqlParser/SparqlQleverVisitor.cpp
realHannes Apr 29, 2024
d0f0d63
renaming in NaryExpression.h for accordance with other function, addi…
realHannes Apr 29, 2024
a118609
added test coverage for function calls makeIntExpression and make Dou…
realHannes Apr 29, 2024
062052e
toNumeric has now correct behavior and uses absl::from_chars() and st…
realHannes Apr 29, 2024
6d0f42a
made clang-format for NaryExpressionImpl.h
realHannes Apr 29, 2024
f90b8e2
Merge branch 'ad-freiburg:master' into master
realHannes May 6, 2024
fb88493
Merge branch 'ad-freiburg:master' into master
realHannes May 15, 2024
b2eb514
Merge remote-tracking branch 'upstream/master'
realHannes May 16, 2024
b165ac1
Merge branch 'ad-freiburg:master' into master
realHannes Jun 1, 2024
7a3dfb2
Merge branch 'master' of https://github.com/realHannes/qlever
realHannes Jun 1, 2024
fc0ad3a
Merge branch 'ad-freiburg:master' into master
realHannes Jun 6, 2024
f3e6086
Merge branch 'ad-freiburg:master' into master
realHannes Jun 7, 2024
fd4c351
Merge branch 'ad-freiburg:master' into master
realHannes Jun 10, 2024
220c9bf
Merge branch 'ad-freiburg:master' into master
realHannes Jun 12, 2024
a81cb8a
Merge branch 'ad-freiburg:master' into master
realHannes Jun 13, 2024
acc0109
Merge branch 'ad-freiburg:master' into master
realHannes Jun 14, 2024
cb8e560
Merge branch 'ad-freiburg:master' into master
realHannes Jun 20, 2024
2b39970
Merge branch 'ad-freiburg:master' into master
realHannes Jun 28, 2024
a0101e4
Merge branch 'ad-freiburg:master' into master
realHannes Jun 30, 2024
47dee1d
Merge branch 'ad-freiburg:master' into master
realHannes Sep 4, 2024
a8625f9
Merge branch 'ad-freiburg:master' into master
realHannes Sep 9, 2024
7f95069
Merge branch 'ad-freiburg:master' into master
realHannes Sep 12, 2024
28b8a69
Merge branch 'ad-freiburg:master' into master
realHannes Sep 13, 2024
7bb6e01
Merge branch 'ad-freiburg:master' into master
realHannes Sep 14, 2024
edc974a
Add implementation for pre-filtering blocks on their metadata
realHannes Sep 18, 2024
ca6c2ff
Merge branch 'master' into prefilter_on_metadata_relational
realHannes Sep 18, 2024
46be51a
fix spelling error
realHannes Sep 18, 2024
0385b56
add namespace for CompressedBlockPrefiltering.h
realHannes Sep 18, 2024
5707338
use std::ranges::set_union, std::ranges::upper_bound/lower_bound
realHannes Sep 18, 2024
c9687ec
move template specializations into namespace prefilterExpressions
realHannes Sep 18, 2024
d8246f7
fix
realHannes Sep 18, 2024
66b4872
hopefully fix namespace issue
realHannes Sep 18, 2024
e4eddc4
Merge branch 'ad-freiburg:master' into prefilter_on_metadata_relational
realHannes Sep 20, 2024
b5d7dd7
first adaptations regarding the comments
realHannes Sep 20, 2024
802e3aa
Merge branch 'ad-freiburg:master' into prefilter_on_metadata_relational
realHannes Sep 23, 2024
662b1d4
applied suggestions from review
realHannes Sep 24, 2024
510aa9e
fix std::move
realHannes Sep 24, 2024
0d7f75b
Merge branch 'ad-freiburg:master' into prefilter_on_metadata_relational
realHannes Sep 25, 2024
c119200
adjusted CompressedBlockPrefiltering
realHannes Sep 26, 2024
af17181
mark method with override
realHannes Sep 26, 2024
3d7238d
Merge branch 'master' into prefilter_on_metadata_relational
realHannes Oct 8, 2024
5af6138
make further changes to prefiltering procedure and its tests
realHannes Oct 8, 2024
b02dc57
add additional testing on IDs from other datatypes
realHannes Oct 8, 2024
eb86f1b
addition to test Not Expression with And and Or
realHannes Oct 8, 2024
69ed019
changes to test and fix index check fail
realHannes Oct 9, 2024
854322b
increase test coverage for Not expression
realHannes Oct 9, 2024
b2aa689
just add all mixed blocks
realHannes Oct 9, 2024
546c3b3
Merge branch 'ad-freiburg:master' into prefilter_on_metadata_relational
realHannes Oct 9, 2024
7e61cb1
remove unnecessary values in test context
realHannes Oct 9, 2024
009ebed
for sonar check
realHannes Oct 10, 2024
6c19bf6
Merge branch 'ad-freiburg:master' into prefilter_on_metadata_relational
realHannes Oct 10, 2024
bf733ce
Merge branch 'ad-freiburg:master' into environment_for_using_prefilte…
realHannes Oct 12, 2024
5b42c1f
methods to get PrefilterExpresssions from RelationalExpressions (Spar…
realHannes Oct 12, 2024
6cf6609
Completed the implementation for constructing PrefilterExpressions fr…
realHannes Oct 22, 2024
18c4c84
Merge branch 'master' into environment_for_using_prefiltering
realHannes Oct 22, 2024
e4be1fe
all builds should compile now
realHannes Oct 22, 2024
bde09cd
Merge branch 'ad-freiburg:master' into environment_for_using_prefilte…
realHannes Oct 22, 2024
74756fe
fix build issue and increase test coverage
realHannes Oct 22, 2024
1278d39
Merge branch 'master' into environment_for_using_prefiltering
realHannes Oct 22, 2024
47d3d56
Merge branch 'ad-freiburg:master' into environment_for_using_prefilte…
realHannes Oct 25, 2024
49de4d0
introduce test structure from PR1 (#1503)
realHannes Oct 25, 2024
fcefdf0
Merge branch 'master' into environment_for_using_prefiltering
realHannes Oct 28, 2024
9f0efc6
fix build
realHannes Oct 28, 2024
25f325a
implement proposed changes (2)
realHannes Oct 30, 2024
d65acc3
correction for codespell check
realHannes Oct 30, 2024
f85a96f
fix for codespell
realHannes Oct 30, 2024
0a188a5
Merge branch 'ad-freiburg:master' into environment_for_using_prefilte…
realHannes Oct 31, 2024
5f4e586
remove optionality (std::optional) for return value
realHannes Oct 31, 2024
8062753
Merge branch 'ad-freiburg:master' into environment_for_using_prefilte…
realHannes Nov 4, 2024
c06de60
implement proposed improvements (4)
realHannes Nov 4, 2024
95e9027
further adjustments + apply PrefilterExpressions in IndexScan
realHannes Nov 11, 2024
0992fab
Merge branch 'master' into environment_for_using_prefiltering
realHannes Nov 11, 2024
f489b24
few additional adaptations
realHannes Nov 11, 2024
1340021
Make `CartesianProductJoin` lazy. (#1609)
RobinTF Nov 13, 2024
23cea27
Get `PrefilterExpression` from `SparqlExpression` (#1613)
realHannes Nov 14, 2024
5144b47
Add STDEV() aggregate function (#1614)
ullingerc Nov 14, 2024
e9e6f8d
Merge located triples when performing index scans (#1597)
joka921 Nov 14, 2024
96ded86
Merge branch 'master' into implement-apply-prefilter-expressions
realHannes Nov 15, 2024
45cc1b4
changes w.r.t. comments from #1573
realHannes Nov 18, 2024
0a3f67e
Merge branch 'ad-freiburg:master' into implement-apply-prefilter-expr…
realHannes Nov 19, 2024
0b30ad3
updates from code review (1)
realHannes Nov 20, 2024
4bf0d01
Merge branch 'ad-freiburg:master' into implement-apply-prefilter-expr…
realHannes Nov 20, 2024
54c00ad
first empty prefilter scan fix
realHannes Nov 21, 2024
118ad87
Fix the bug that always disables prefilter expressions.
joka921 Nov 21, 2024
f47cc2c
Merge branch 'ad-freiburg:master' into implement-apply-prefilter-expr…
realHannes Nov 21, 2024
61a15ce
select only Variable for first column index + extend constructor
realHannes Nov 21, 2024
6ef031b
set multiplicities in IndexScan constructor
realHannes Nov 21, 2024
bef8211
changes for review (1)
realHannes Nov 23, 2024
80d54df
changes for review (2)
realHannes Nov 24, 2024
25eb418
correction for Codespell
realHannes Nov 24, 2024
83f2363
add testing
realHannes Nov 27, 2024
097e206
Merge branch 'master' into implement-apply-prefilter-expressions
realHannes Nov 27, 2024
1574860
FilterTest fix + codespell fix
realHannes Nov 27, 2024
9de745a
simplify test in IndexScanTest
realHannes Nov 27, 2024
0a7672c
more changes
realHannes Nov 28, 2024
0ff8689
test
realHannes Nov 28, 2024
bef9326
Merge branch 'master' into implement-apply-prefilter-expressions
realHannes Nov 29, 2024
6e54939
fix test error
realHannes Nov 29, 2024
2751fe1
adapt code part merge conflict
realHannes Nov 29, 2024
a884e39
Merge branch 'master' into implement-apply-prefilter-expressions
realHannes Nov 30, 2024
d5ad1ba
use std::move + adjust test for this PR
realHannes Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/engine/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
sparqlExpression::SparqlExpressionPimpl expression)
: Operation(qec),
_subtree(std::move(subtree)),
_expression{std::move(expression)} {}
_expression{std::move(expression)} {
setPrefilterExpressionForDirectIndexScanChild();
}

// _____________________________________________________________________________
string Filter::getCacheKeyImpl() const {
Expand All @@ -37,10 +39,22 @@
return std::move(os).str();
}

//______________________________________________________________________________
string Filter::getDescriptor() const {
return absl::StrCat("Filter ", _expression.getDescriptor());
}

//______________________________________________________________________________
void Filter::setPrefilterExpressionForDirectIndexScanChild() {
std::vector<PrefilterVariablePair> prefilterPairs =
_expression.getPrefilterExpressionForMetadata();
auto optNewSubTree =
_subtree->setPrefilterExprGetUpdatedQetPtr(std::move(prefilterPairs));
if (optNewSubTree.has_value()) {
_subtree = std::move(optNewSubTree.value());
}

Check warning on line 55 in src/engine/Filter.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Filter.cpp#L54-L55

Added lines #L54 - L55 were not covered by tests
}

// _____________________________________________________________________________
ProtoResult Filter::computeResult(bool requestLaziness) {
LOG(DEBUG) << "Getting sub-result for Filter result computation..." << endl;
Expand Down
9 changes: 8 additions & 1 deletion src/engine/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

#include "engine/Operation.h"
#include "engine/QueryExecutionTree.h"
#include "engine/sparqlExpressions/SparqlExpressionPimpl.h"
#include "parser/ParsedQuery.h"

class Filter : public Operation {
using PrefilterVariablePair = sparqlExpression::PrefilterExprVariablePair;

private:
std::shared_ptr<QueryExecutionTree> _subtree;
sparqlExpression::SparqlExpressionPimpl _expression;
Expand Down Expand Up @@ -58,6 +59,12 @@ class Filter : public Operation {
return _subtree->getVariableColumns();
}

// This method is directly called by the constructor.
// It sets the appropriate `<PrefilterExpression, Variable>` pair for each
// `IndexScan` child by invoking `setPrefilterExpression` on all descendants
// in the `QueryExecutionTree`.
void setPrefilterExpressionForDirectIndexScanChild();
realHannes marked this conversation as resolved.
Show resolved Hide resolved

ProtoResult computeResult(bool requestLaziness) override;

// Perform the actual filter operation of the data provided.
Expand Down
169 changes: 136 additions & 33 deletions src/engine/IndexScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@

// _____________________________________________________________________________
IndexScan::IndexScan(QueryExecutionContext* qec, Permutation::Enum permutation,
const SparqlTripleSimple& triple, Graphs graphsToFilter)
const SparqlTripleSimple& triple, Graphs graphsToFilter,
PrefilterIndexPair prefilter)
: Operation(qec),
permutation_(permutation),
subject_(triple.s_),
predicate_(triple.p_),
object_(triple.o_),
graphsToFilter_{std::move(graphsToFilter)},
prefilter_{std::move(prefilter)},
numVariables_(static_cast<size_t>(subject_.isVariable()) +
static_cast<size_t>(predicate_.isVariable()) +
static_cast<size_t>(object_.isVariable())) {
Expand Down Expand Up @@ -51,9 +53,27 @@

// _____________________________________________________________________________
IndexScan::IndexScan(QueryExecutionContext* qec, Permutation::Enum permutation,
const SparqlTriple& triple, Graphs graphsToFilter)
: IndexScan(qec, permutation, triple.getSimple(),
std::move(graphsToFilter)) {}
const SparqlTriple& triple, Graphs graphsToFilter,
PrefilterIndexPair prefilter)
: IndexScan(qec, permutation, triple.getSimple(), std::move(graphsToFilter),
std::move(prefilter)) {}

// _____________________________________________________________________________
IndexScan::IndexScan(QueryExecutionContext* qec, Permutation::Enum permutation,
const TripleComponent& s, const TripleComponent& p,
const TripleComponent& o,
std::vector<ColumnIndex> additionalColumns,
std::vector<Variable> additionalVariables,
Graphs graphsToFilter, PrefilterIndexPair prefilter)
: Operation(qec),
permutation_(permutation),
subject_(s),
predicate_(p),
object_(o),
graphsToFilter_(std::move(graphsToFilter)),
prefilter_(std::move(prefilter)),
additionalColumns_(std::move(additionalColumns)),
additionalVariables_(std::move(additionalVariables)) {}

Check warning on line 76 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L76

Added line #L76 was not covered by tests
realHannes marked this conversation as resolved.
Show resolved Hide resolved

// _____________________________________________________________________________
string IndexScan::getCacheKeyImpl() const {
Expand Down Expand Up @@ -89,6 +109,12 @@
os << "\nFiltered by Graphs:";
os << absl::StrJoin(graphIdVec, " ");
}
if (prefilter_.has_value()) {
auto& [prefilterExpr, columnIdx] = prefilter_.value();
os << "Added PrefiterExpression: \n";
os << *prefilterExpr;
os << "\n Applied on: " << columnIdx << ".";
}

Check warning on line 117 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L113-L117

Added lines #L113 - L117 were not covered by tests
return std::move(os).str();
}

Expand All @@ -115,6 +141,24 @@
return result;
}

// _____________________________________________________________________________
std::optional<std::shared_ptr<QueryExecutionTree>>
IndexScan::setPrefilterExprGetUpdatedQetPtr(
std::vector<PrefilterVariablePair> prefilterVariablePairs) {
if (numVariables_ < 1) {
return std::nullopt;
}

Check warning on line 150 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L149-L150

Added lines #L149 - L150 were not covered by tests

auto map = getVariableToSortedIndexMap();
for (auto& [prefilterExpr, variable] : prefilterVariablePairs) {
if (map.find(variable) != map.end()) {
return makeCopyWithAddedPrefilters(
std::make_pair(prefilterExpr->clone(), map[variable]));
}
}

Check warning on line 158 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L155-L158

Added lines #L155 - L158 were not covered by tests
realHannes marked this conversation as resolved.
Show resolved Hide resolved
return std::nullopt;
}

// _____________________________________________________________________________
VariableToColumnMap IndexScan::computeVariableToColumnMap() const {
VariableToColumnMap variableToColumnMap;
Expand All @@ -134,40 +178,60 @@
return variableToColumnMap;
}

//______________________________________________________________________________
std::shared_ptr<QueryExecutionTree> IndexScan::makeCopyWithAddedPrefilters(
PrefilterIndexPair prefilter) const {
return ad_utility::makeExecutionTree<IndexScan>(
getExecutionContext(), permutation_, subject_, predicate_, object_,
additionalColumns_, additionalVariables_, graphsToFilter_,
std::move(prefilter));
}

Check warning on line 188 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L183-L188

Added lines #L183 - L188 were not covered by tests

// _____________________________________________________________________________
Result::Generator IndexScan::scanInChunks() const {
auto metadata = getMetadataForScan();
if (!metadata.has_value()) {
Result::Generator IndexScan::chunkedIndexScan() const {
auto optBlockSpan = getOptionalBlockSpan();
if (!optBlockSpan.has_value()) {
co_return;
}
auto blocksSpan =
CompressedRelationReader::getBlocksFromMetadata(metadata.value());
std::vector<CompressedBlockMetadata> blocks{blocksSpan.begin(),
blocksSpan.end()};
for (IdTable& idTable : getLazyScan(std::move(blocks))) {
const auto& blockSpan = optBlockSpan.value();
for (IdTable& idTable : getLazyScan({blockSpan.begin(), blockSpan.end()})) {
realHannes marked this conversation as resolved.
Show resolved Hide resolved
co_yield {std::move(idTable), LocalVocab{}};
}
}

// _____________________________________________________________________________
ProtoResult IndexScan::computeResult(bool requestLaziness) {
LOG(DEBUG) << "IndexScan result computation...\n";
if (requestLaziness) {
return {scanInChunks(), resultSortedOn()};
IdTable IndexScan::materializedIndexScan() const {
// Get the blocks.
auto optBlockSpan = getOptionalBlockSpan();
std::optional<std::vector<CompressedBlockMetadata>> optFilteredBlocks = {};
if (optBlockSpan.has_value()) {
const auto& blockSpan = optBlockSpan.value();
optFilteredBlocks =
getOptionalPrefilteredBlocks({blockSpan.begin(), blockSpan.end()});
realHannes marked this conversation as resolved.
Show resolved Hide resolved
}
IdTable idTable{getExecutionContext()->getAllocator()};

// Create the IdTable and fill it with content by performing scan().
using enum Permutation::Enum;
IdTable idTable{getExecutionContext()->getAllocator()};
idTable.setNumColumns(numVariables_);
const auto& index = _executionContext->getIndex();
idTable =
index.scan(getScanSpecification(), permutation_, additionalColumns(),
cancellationHandle_, locatedTriplesSnapshot(), getLimit());
idTable = index.getImpl()
realHannes marked this conversation as resolved.
Show resolved Hide resolved
.getPermutation(permutation_)
.scan(getScanSpecification(), additionalColumns(),
cancellationHandle_, locatedTriplesSnapshot(), getLimit(),
optFilteredBlocks);
AD_CORRECTNESS_CHECK(idTable.numColumns() == getResultWidth());
LOG(DEBUG) << "IndexScan result computation done.\n";
checkCancellation();
return idTable;
}

return {std::move(idTable), resultSortedOn(), LocalVocab{}};
// _____________________________________________________________________________
ProtoResult IndexScan::computeResult(bool requestLaziness) {
LOG(DEBUG) << "IndexScan result computation...\n";
if (requestLaziness) {
return {chunkedIndexScan(), resultSortedOn()};
}
return {materializedIndexScan(), getResultSortedOn(), LocalVocab{}};
}

// _____________________________________________________________________________
Expand Down Expand Up @@ -219,7 +283,7 @@
AD_CONTRACT_CHECK(multiplicity_.size() == getResultWidth());
}

// ___________________________________________________________________________
// _____________________________________________________________________________
std::array<const TripleComponent* const, 3> IndexScan::getPermutedTriple()
const {
std::array triple{&subject_, &predicate_, &object_};
Expand All @@ -228,30 +292,69 @@
triple[permutation[2]]};
}

// ___________________________________________________________________________
// _____________________________________________________________________________
ScanSpecification IndexScan::getScanSpecification() const {
const IndexImpl& index = getIndex().getImpl();
return getScanSpecificationTc().toScanSpecification(index);
}

// ___________________________________________________________________________
// _____________________________________________________________________________
ScanSpecificationAsTripleComponent IndexScan::getScanSpecificationTc() const {
auto permutedTriple = getPermutedTriple();
return {*permutedTriple[0], *permutedTriple[1], *permutedTriple[2],
graphsToFilter_};
}

// ___________________________________________________________________________
// _____________________________________________________________________________
ad_utility::HashMap<Variable, ColumnIndex>
IndexScan::getVariableToSortedIndexMap() const {
ad_utility::HashMap<Variable, ColumnIndex> map;
ColumnIndex idx = 0;
for (const TripleComponent* const ptr : getPermutedTriple()) {
if (!ptr->isVariable()) {
break;
}
map[ptr->getVariable()] = idx;
idx++;
}
return map;
}

// _____________________________________________________________________________
std::optional<std::span<const CompressedBlockMetadata>>
IndexScan::getOptionalBlockSpan() const {
auto metadata = getMetadataForScan();
if (metadata.has_value()) {
return CompressedRelationReader::getBlocksFromMetadata(metadata.value());
}
return std::nullopt;
}

// _____________________________________________________________________________
std::optional<std::vector<CompressedBlockMetadata>>
IndexScan::getOptionalPrefilteredBlocks(
std::vector<CompressedBlockMetadata> blocks) const {
if (!getLimit().isUnconstrained()) {
return std::nullopt;
}

if (prefilter_.has_value()) {
// Apply the prefilter on given blocks.
auto& [prefilterExpr, columnIndex] = prefilter_.value();
return prefilterExpr->evaluate(blocks, columnIndex);

Check warning on line 344 in src/engine/IndexScan.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/IndexScan.cpp#L343-L344

Added lines #L343 - L344 were not covered by tests
} else {
return blocks;
}
}

// _____________________________________________________________________________
Permutation::IdTableGenerator IndexScan::getLazyScan(
std::vector<CompressedBlockMetadata> blocks) const {
// If there is a LIMIT or OFFSET clause that constrains the scan
// (which can happen with an explicit subquery), we cannot use the prefiltered
// blocks, as we currently have no mechanism to include limits and offsets
// into the prefiltering (`std::nullopt` means `scan all blocks`).
auto actualBlocks = getLimit().isUnconstrained()
? std::optional{std::move(blocks)}
: std::nullopt;

auto actualBlocks = getOptionalPrefilteredBlocks(std::move(blocks));
return getIndex()
.getImpl()
.getPermutation(permutation())
Expand All @@ -260,15 +363,15 @@
locatedTriplesSnapshot(), getLimit());
};

// ________________________________________________________________
// _____________________________________________________________________________
std::optional<Permutation::MetadataAndBlocks> IndexScan::getMetadataForScan()
const {
const auto& index = getExecutionContext()->getIndex().getImpl();
return index.getPermutation(permutation())
.getMetadataAndBlocks(getScanSpecification(), locatedTriplesSnapshot());
};

// ________________________________________________________________
// _____________________________________________________________________________
std::array<Permutation::IdTableGenerator, 2>
IndexScan::lazyScanForJoinOfTwoScans(const IndexScan& s1, const IndexScan& s2) {
AD_CONTRACT_CHECK(s1.numVariables_ <= 3 && s2.numVariables_ <= 3);
Expand Down Expand Up @@ -317,7 +420,7 @@
return result;
}

// ________________________________________________________________
// _____________________________________________________________________________
Permutation::IdTableGenerator IndexScan::lazyScanForJoinOfColumnWithScan(
std::span<const Id> joinColumn) const {
AD_EXPENSIVE_CHECK(std::ranges::is_sorted(joinColumn));
Expand Down
Loading
Loading