| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/optimizer/rule/date_part_simplification.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/optimizer/rule.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | |
| 15 | // The DatePart Simplification rule rewrites date_part with a constant specifier into a specialized function (e.g. |
| 16 | // date_part('year', x) => year(x)) |
| 17 | class DatePartSimplificationRule : public Rule { |
| 18 | public: |
| 19 | explicit DatePartSimplificationRule(ExpressionRewriter &rewriter); |
| 20 | |
| 21 | unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made, |
| 22 | bool is_root) override; |
| 23 | }; |
| 24 | |
| 25 | } // namespace duckdb |
| 26 | |