◆ Optimize()
Optimize PROJECTION + LIMIT to LIMIT + Projection.
315103 {
315105 auto projection = std::move(op->children[0]);
315106 op->children[0] = std::move(projection->children[0]);
315107 projection->SetEstimatedCardinality(op->estimated_cardinality);
315108 projection->children[0] = std::move(op);
315109 swap(projection, op);
315110 }
315111 for (auto &child : op->children) {
315112 child =
Optimize(std::move(child));
315113 }
315114 return op;
315115}
unique_ptr< LogicalOperator > Optimize(unique_ptr< LogicalOperator > op)
Optimize PROJECTION + LIMIT to LIMIT + Projection.
Definition duckdb.cpp:315103
static bool CanOptimize(LogicalOperator &op)
Whether we can perform the optimization on this operator.
Definition duckdb.cpp:315082
void swap(Mat &a, Mat &b)
◆ CanOptimize()
Whether we can perform the optimization on this operator.
315082 {
315083 if (op.
type == LogicalOperatorType::LOGICAL_LIMIT &&
315084 op.
children[0]->type == LogicalOperatorType::LOGICAL_PROJECTION) {
315085 auto &limit = op.Cast<LogicalLimit>();
315086
315087 if (limit.offset_val.Type() == LimitNodeType::EXPRESSION_PERCENTAGE ||
315088 limit.offset_val.Type() == LimitNodeType::EXPRESSION_VALUE) {
315089
315090 return false;
315091 }
315092
315093 if (limit.limit_val.Type() == LimitNodeType::CONSTANT_VALUE && limit.limit_val.GetConstantValue() < 8192) {
315094
315095
315096
315097 return true;
315098 }
315099 }
315100 return false;
315101}
vector< unique_ptr< LogicalOperator > > children
The set of children of the operator.
Definition duckdb.hpp:21262
LogicalOperatorType type
The type of the logical operator.
Definition duckdb.hpp:21260
The documentation for this class was generated from the following file: