Skip to content

Commit

Permalink
update projection cardinality when limit is pushed down
Browse files Browse the repository at this point in the history
  • Loading branch information
jeewonhh committed Nov 19, 2024
1 parent d6b0849 commit b43d59b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/optimizer/limit_pushdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "duckdb/planner/operator/logical_limit.hpp"
#include "duckdb/planner/operator/logical_projection.hpp"

#include <complex>

namespace duckdb {

bool LimitPushdown::CanOptimize(duckdb::LogicalOperator &op) {
Expand Down Expand Up @@ -30,6 +32,7 @@ unique_ptr<LogicalOperator> LimitPushdown::Optimize(unique_ptr<LogicalOperator>
if (CanOptimize(*op)) {
auto projection = std::move(op->children[0]);
op->children[0] = std::move(projection->children[0]);
projection->SetEstimatedCardinality(op->estimated_cardinality);
projection->children[0] = std::move(op);
swap(projection, op);
}
Expand Down

0 comments on commit b43d59b

Please sign in to comment.