From 652878738e9de13ee85210e52edf9d4e8a7bb294 Mon Sep 17 00:00:00 2001 From: RobinTF <83676088+RobinTF@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:12:25 +0100 Subject: [PATCH] Implement limit support for `Bind` --- src/engine/Bind.cpp | 4 ++++ src/engine/Bind.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/engine/Bind.cpp b/src/engine/Bind.cpp index 95de8a4dfe..a0e7e78c9a 100644 --- a/src/engine/Bind.cpp +++ b/src/engine/Bind.cpp @@ -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) { @@ -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 subRes = _subtree->getResult(requestLaziness); LOG(DEBUG) << "Got input to Bind operation." << std::endl; diff --git a/src/engine/Bind.h b/src/engine/Bind.h index 34c515fb54..0abd5b2cec 100644 --- a/src/engine/Bind.h +++ b/src/engine/Bind.h @@ -30,6 +30,7 @@ class Bind : public Operation { [[nodiscard]] size_t getResultWidth() const override; std::vector getChildren() override; size_t getCostEstimate() override; + bool supportsLimit() const override; private: uint64_t getSizeEstimateBeforeLimit() override;