| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/optimizer/rule/arithmetic_simplification.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/optimizer/rule.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | |
| 15 | // The Arithmetic Simplification rule applies arithmetic expressions to which the answer is known (e.g. X + 0 => X, X * |
| 16 | // 0 => 0) |
| 17 | class ArithmeticSimplificationRule : public Rule { |
| 18 | public: |
| 19 | explicit ArithmeticSimplificationRule(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 | |