From 09315e559caf238aa1965bd92552528e1d5f84ea Mon Sep 17 00:00:00 2001 From: Li Yichao Date: Tue, 8 Nov 2022 10:06:03 +0800 Subject: [PATCH] we should set upper bound to cur cost. --- src/optimizer/optimizer_task.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/optimizer/optimizer_task.cpp b/src/optimizer/optimizer_task.cpp index 6bb9e9d3b1..cc5413ce32 100644 --- a/src/optimizer/optimizer_task.cpp +++ b/src/optimizer/optimizer_task.cpp @@ -345,7 +345,7 @@ void OptimizeExpressionCostWithEnforcedProperty::Execute() { // Can meet the requirement if (meet_requirement && cur_total_cost_ <= context_->GetCostUpperBound()) { // If the cost is smaller than the winner, update the context upper bound - context_->SetCostUpperBound(context_->GetCostUpperBound() - cur_total_cost_); + context_->SetCostUpperBound(cur_total_cost_); if (memo_enforced_expr != nullptr) { // Enforcement takes place cur_group->SetExpressionCost(memo_enforced_expr, cur_total_cost_, context_->GetRequiredProperties()->Copy()); } else if (output_prop->Properties().size() != context_->GetRequiredProperties()->Properties().size()) {