fix not add enumset to str above questionmark bug

This commit is contained in:
obdev 2023-03-06 04:14:01 +00:00 committed by ob-robot
parent 1581cac17a
commit 4f2ab1f735
3 changed files with 19 additions and 9 deletions

View File

@ -559,15 +559,21 @@ int ObExprLike::cg_expr(ObExprCGCtx &op_cg_ctx,
ret = OB_ERR_UNEXPECTED;
LOG_WARN("child is null", K(ret), K(rt_expr.args_[0]), K(rt_expr.args_[1]),
K(rt_expr.args_[2]));
} else if (OB_UNLIKELY(!((ob_is_string_tc(rt_expr.args_[0]->datum_meta_.type_)
|| ObLongTextType == rt_expr.args_[0]->datum_meta_.type_
|| ObNullType == rt_expr.args_[0]->datum_meta_.type_)))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected param type", K(ret), K(rt_expr.args_[0]->datum_meta_));
} else if (OB_UNLIKELY(!(ob_is_string_tc(rt_expr.args_[1]->datum_meta_.type_)
|| ObLongTextType == rt_expr.args_[1]->datum_meta_.type_
|| ObNullType == rt_expr.args_[1]->datum_meta_.type_))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected param type", K(ret), K(rt_expr.args_[1]->datum_meta_));
} else if (OB_UNLIKELY(!(ObVarcharType == rt_expr.args_[2]->datum_meta_.type_
|| ObNullType == rt_expr.args_[2]->datum_meta_.type_))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected param type", K(ret), K(rt_expr.args_[2]->datum_meta_));
} else {
OB_ASSERT(ob_is_string_tc(rt_expr.args_[0]->datum_meta_.type_)
|| ObLongTextType == rt_expr.args_[0]->datum_meta_.type_
|| ObNullType == rt_expr.args_[0]->datum_meta_.type_);
OB_ASSERT(ob_is_string_tc(rt_expr.args_[1]->datum_meta_.type_)
|| ObLongTextType == rt_expr.args_[1]->datum_meta_.type_
|| ObNullType == rt_expr.args_[1]->datum_meta_.type_);
OB_ASSERT(ObVarcharType == rt_expr.args_[2]->datum_meta_.type_
|| ObNullType == rt_expr.args_[2]->datum_meta_.type_);
//Do optimization even if pattern_expr/escape is pushdown parameter, pattern and escape are
//checked whether the same as last time which is recorded in like_ctx for each row in execution.
bool pattern_literal = pattern_expr->is_const_expr();

View File

@ -92,6 +92,8 @@ int ObRawExprInfoExtractor::visit(ObQueryRefRawExpr &expr)
LOG_WARN("failed to pull info from child", K(ret));
} else if (OB_FAIL(expr.add_flag(IS_SUB_QUERY))) {
LOG_WARN("failed to add is sub query flag", K(ret));
} else if (ob_is_enumset_tc(expr.get_data_type()) && OB_FAIL(expr.add_flag(IS_ENUM_OR_SET))) {
LOG_WARN("failed to add flag IS_ENUM_OR_SET", K(expr), K(ret));
}
return ret;
}

View File

@ -176,7 +176,6 @@ int ObRawExprWrapEnumSet::analyze_all_expr(ObDMLStmt &stmt)
} else if (OB_FAIL(stmt.get_child_stmts(child_stmts))) {
LOG_WARN("get child stmt failed", K(ret));
} else {/*do nothing*/}
for (int64_t i = 0; OB_SUCC(ret) && i < relation_exprs.count(); ++i) {
if (OB_FAIL(analyze_expr(relation_exprs.at(i)))) {
LOG_WARN("failed to analyze expr", K(ret));
@ -201,6 +200,9 @@ int ObRawExprWrapEnumSet::analyze_expr(ObRawExpr *expr)
if (OB_ISNULL(expr)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("expr is NULL", K(ret));
// extract info before in case that IS/CNT_ENUM_OR_SET flag has not been set.
} else if (OB_FAIL(expr->extract_info())) {
LOG_WARN("extract info failed", K(ret));
} else if (OB_FAIL(expr->postorder_accept(*this))) {
LOG_WARN("failed to postorder_accept", K(ret));
} else {/*do nothing*/}