//===----------------------------------------------------------------------===// // DuckDB // // duckdb/optimizer/rule.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/optimizer/matcher/expression_matcher.hpp" #include "duckdb/optimizer/matcher/logical_operator_matcher.hpp" namespace duckdb { class ExpressionRewriter; class Rule { public: explicit Rule(ExpressionRewriter &rewriter) : rewriter(rewriter) { } virtual ~Rule() { } //! The expression rewriter this rule belongs to ExpressionRewriter &rewriter; //! The root unique_ptr logical_root; //! The expression matcher of the rule unique_ptr root; ClientContext &GetContext() const; virtual unique_ptr Apply(LogicalOperator &op, vector> &bindings, bool &fixed_point, bool is_root) = 0; }; } // namespace duckdb