| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/optimizer/rule/move_constants.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/optimizer/rule.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | |
| 15 | // The MoveConstantsRule moves constants to the same side of an expression, e.g. if we have an expression x + 1 = 5000 |
| 16 | // then this will turn it into x = 4999. |
| 17 | class MoveConstantsRule : public Rule { |
| 18 | public: |
| 19 | explicit MoveConstantsRule(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 | |