Skip to content

Commit

Permalink
Implement limit support for Bind (#1795)
Browse files Browse the repository at this point in the history
Just a small change that allows `Bind` to avoid computing SPARQL expressions when a `LIMIT` or `OFFSET` is present, that would just trim them away anyway.
  • Loading branch information
RobinTF authored Feb 12, 2025
1 parent eef2765 commit 6a571f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/engine/Bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ size_t Bind::getCostEstimate() {
return _subtree->getCostEstimate() + _subtree->getSizeEstimate();
}

// We delegate the limit to the child operation, so we always support it.
bool Bind::supportsLimit() const { return true; }

float Bind::getMultiplicity(size_t col) {
// this is the newly added column
if (col == getResultWidth() - 1) {
Expand Down Expand Up @@ -93,6 +96,7 @@ IdTable Bind::cloneSubView(const IdTable& idTable,

// _____________________________________________________________________________
ProtoResult Bind::computeResult(bool requestLaziness) {
_subtree->setLimit(getLimit());
LOG(DEBUG) << "Get input to BIND operation..." << std::endl;
std::shared_ptr<const Result> subRes = _subtree->getResult(requestLaziness);
LOG(DEBUG) << "Got input to Bind operation." << std::endl;
Expand Down
1 change: 1 addition & 0 deletions src/engine/Bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Bind : public Operation {
[[nodiscard]] size_t getResultWidth() const override;
std::vector<QueryExecutionTree*> getChildren() override;
size_t getCostEstimate() override;
bool supportsLimit() const override;

private:
uint64_t getSizeEstimateBeforeLimit() override;
Expand Down

0 comments on commit 6a571f9

Please sign in to comment.