[CP] remove const params in window function

This commit is contained in:
obdev
2022-06-02 10:10:55 +08:00
committed by wangzelin.wzl
parent 75ca779e47
commit bc26b2f163
4 changed files with 54 additions and 1 deletions

View File

@ -3579,6 +3579,42 @@ int ObWindow::assign(const ObWindow& other)
return ret;
}
int ObWindow::remove_const_params()
{
int ret = OB_SUCCESS;
int64_t cnt_part_expr = 0;
int64_t cnt_order_item = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < partition_exprs_.count(); ++i) {
if (OB_ISNULL(partition_exprs_.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (partition_exprs_.at(i)->has_const_or_const_expr_flag()) {
/*do nothing */
} else {
partition_exprs_.at(cnt_part_expr++) = partition_exprs_.at(i);
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < order_items_.count(); ++i) {
if (OB_ISNULL(order_items_.at(i).expr_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (order_items_.at(i).expr_->has_const_or_const_expr_flag()) {
/*do nothing */
} else {
order_items_.at(cnt_order_item++) = order_items_.at(i);
}
}
if (OB_SUCC(ret)) {
while (partition_exprs_.count() > cnt_part_expr) {
partition_exprs_.pop_back();
}
while (order_items_.count() > cnt_order_item) {
order_items_.pop_back();
}
}
return ret;
}
void ObWinFunRawExpr::clear_child()
{
func_type_ = T_MAX;

View File

@ -3759,8 +3759,8 @@ public:
{
return order_items_;
}
int assign(const ObWindow &other);
int remove_const_params();
common::ObArray<ObRawExpr *, common::ModulePageAllocator, true> partition_exprs_;
common::ObArray<OrderItem, common::ModulePageAllocator, true> order_items_;