1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/optimizer/rule/empty_needle_removal.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/optimizer/rule.hpp"
12
13namespace duckdb {
14
15// The Empty_needle_removal Optimization rule folds some foldable ConstantExpression
16//(e.g.: PREFIX('xyz', '') is TRUE, PREFIX(NULL, '') is NULL, so rewrite PREFIX(x, '') to (CASE WHEN x IS NOT NULL THEN)
17class EmptyNeedleRemovalRule : public Rule {
18public:
19 explicit EmptyNeedleRemovalRule(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