From ce39c034e0c861e3d804e00ad6c1fa7bc5620b4b Mon Sep 17 00:00:00 2001 From: light-city <455954986@qq.com> Date: Mon, 11 Sep 2023 00:00:09 +0800 Subject: [PATCH] Fix: remove unused variables. Now I see that all the rules do not set logical_root, that is to say, this variable is not used at present, it is only used in ExpressionRewriter::VisitOperator, the conditions here must be satisfied, we can directly clear this dirty code. --- src/include/duckdb/optimizer/rule.hpp | 2 -- src/optimizer/expression_rewriter.cpp | 8 -------- 2 files changed, 10 deletions(-) diff --git a/src/include/duckdb/optimizer/rule.hpp b/src/include/duckdb/optimizer/rule.hpp index a04549fa103..30061a29438 100644 --- a/src/include/duckdb/optimizer/rule.hpp +++ b/src/include/duckdb/optimizer/rule.hpp @@ -23,8 +23,6 @@ class 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; diff --git a/src/optimizer/expression_rewriter.cpp b/src/optimizer/expression_rewriter.cpp index 2e3a19f20f5..fea861e9dab 100644 --- a/src/optimizer/expression_rewriter.cpp +++ b/src/optimizer/expression_rewriter.cpp @@ -59,16 +59,8 @@ void ExpressionRewriter::VisitOperator(LogicalOperator &op) { to_apply_rules.clear(); for (auto &rule : rules) { - if (rule->logical_root && !rule->logical_root->Match(op.type)) { - // this rule does not apply to this type of LogicalOperator - continue; - } to_apply_rules.push_back(*rule); } - if (to_apply_rules.empty()) { - // no rules to apply on this node - return; - } VisitOperatorExpressions(op);