| 1 | #include "duckdb/optimizer/filter_pushdown.hpp" | 
|---|---|
| 2 | #include "duckdb/optimizer/optimizer.hpp" | 
| 3 | #include "duckdb/planner/expression/bound_columnref_expression.hpp" | 
| 4 | #include "duckdb/planner/operator/logical_empty_result.hpp" | 
| 5 | #include "duckdb/planner/operator/logical_limit.hpp" | 
| 6 | |
| 7 | namespace duckdb { | 
| 8 | |
| 9 | unique_ptr<LogicalOperator> FilterPushdown::PushdownLimit(unique_ptr<LogicalOperator> op) { | 
| 10 | auto &limit = op->Cast<LogicalLimit>(); | 
| 11 | |
| 12 | if (!limit.limit && limit.limit_val == 0) { | 
| 13 | return make_uniq<LogicalEmptyResult>(args: std::move(op)); | 
| 14 | } | 
| 15 | |
| 16 | return FinishPushdown(op: std::move(op)); | 
| 17 | } | 
| 18 | |
| 19 | } // namespace duckdb | 
| 20 | 
