cherry-pick bugfix to opensource

This commit is contained in:
obdev
2021-07-12 15:04:52 +08:00
committed by wangzelin.wzl
parent e47392397a
commit 94ba0a393b
7 changed files with 59 additions and 10 deletions

View File

@ -690,7 +690,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
bool param_all_is_ext = true;
bool param_all_same_cs_level = true;
for (int64_t j = 0; OB_SUCC(ret) && j < in_op->get_row_dimension(); ++j) {
param_all_const &= param1->get_param_expr(0)->get_param_expr(j)->has_const_or_const_expr_flag();
param_all_const &= (param1->get_param_expr(0)->get_param_expr(j)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(0)->get_param_expr(j)
->has_flag(IS_EXEC_PARAM));
ObObjType first_obj_type = param1->get_param_expr(0)->get_param_expr(j)->get_data_type();
ObObjType cur_obj_type = ObMaxType;
ObCollationType first_obj_cs_type = param1->get_param_expr(0)->get_param_expr(j)->get_collation_type();
@ -707,7 +709,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
first_obj_cs_type = cur_obj_cs_type;
}
if (ObNullType != first_obj_type && ObNullType != cur_obj_type) {
param_all_const &= param1->get_param_expr(i)->get_param_expr(j)->has_const_or_const_expr_flag();
param_all_const &= (param1->get_param_expr(i)->get_param_expr(j)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(i)->get_param_expr(j)
->has_flag(IS_EXEC_PARAM));
param_all_same_type &= (first_obj_type == cur_obj_type);
param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type);
param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level);
@ -738,7 +742,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
}
}
if (OB_SUCC(ret)) {
bool param_all_const = param1->get_param_expr(0)->has_const_or_const_expr_flag();
bool param_all_const = (param1->get_param_expr(0)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(0)->has_flag(IS_EXEC_PARAM));
bool param_all_same_type = true;
bool param_all_same_cs_type = true;
bool param_all_is_ext = true;
@ -759,7 +764,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
first_obj_cs_type = cur_obj_cs_type;
}
if (ObNullType != first_obj_type && ObNullType != cur_obj_type) {
param_all_const &= param1->get_param_expr(i)->has_const_or_const_expr_flag();
param_all_const &= (param1->get_param_expr(i)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(i)->has_flag(IS_EXEC_PARAM));
param_all_same_type &= (first_obj_type == cur_obj_type);
param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type);
param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level);

View File

@ -628,6 +628,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObMergeDistinctSpec& spec
LOG_WARN("merge distinct has no block mode", K(op.get_algo()), K(op.get_block_mode()), K(ret));
} else if (OB_FAIL(spec.cmp_funcs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.distinct_exprs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init distinct exprs", K(ret));
} else {
ObExpr* expr = nullptr;
ARRAY_FOREACH(op.get_distinct_exprs(), i)
@ -665,6 +667,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObHashDistinctSpec& spec,
LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.sort_collations_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.distinct_exprs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init distinct exprs", K(ret));
} else {
ObExpr* expr = nullptr;
int64_t dist_cnt = 0;