fix eval questionmark table assign val failed bug

This commit is contained in:
Larry955
2022-11-13 02:33:32 +08:00
committed by wangzelin.wzl
parent f5c4cb2cda
commit 74cb7c51f4
3 changed files with 17 additions and 19 deletions

View File

@ -401,22 +401,18 @@ int ObStaticEngineExprCG::cg_expr_by_operator(const ObIArray<ObRawExpr *> &raw_e
|| OB_ISNULL(rt_expr = get_rt_expr(*raw_expr))) { || OB_ISNULL(rt_expr = get_rt_expr(*raw_expr))) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("arg is null", K(raw_expr), K(rt_expr), K(ret)); LOG_WARN("arg is null", K(raw_expr), K(rt_expr), K(ret));
} else if (T_QUESTIONMARK == rt_expr->type_ && rt_question_mark_eval_) { } else if (T_QUESTIONMARK == rt_expr->type_ &&
(raw_expr->has_flag(IS_TABLE_ASSIGN) || rt_question_mark_eval_)) {
// generate question mark expr for get param from param store directly // generate question mark expr for get param from param store directly
// if the questionmark is from TABLE_ASSIGN, use eval_assign_question_mark_func
ObConstRawExpr *c_expr = static_cast<ObConstRawExpr*>(raw_expr); ObConstRawExpr *c_expr = static_cast<ObConstRawExpr*>(raw_expr);
int64_t param_idx = 0; int64_t param_idx = 0;
OZ(c_expr->get_value().get_unknown(param_idx)); OZ(c_expr->get_value().get_unknown(param_idx));
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
rt_expr->extra_ = param_idx; rt_expr->extra_ = param_idx;
rt_expr->eval_func_ = &eval_question_mark_func; rt_expr->eval_func_ = raw_expr->has_flag(IS_TABLE_ASSIGN) ?
} &eval_assign_question_mark_func:
} else if (T_QUESTIONMARK == rt_expr->type_ && raw_expr->has_flag(IS_TABLE_ASSIGN)) { &eval_question_mark_func;
ObConstRawExpr *c_expr = static_cast<ObConstRawExpr*>(raw_expr);
int64_t param_idx = 0;
OZ(c_expr->get_value().get_unknown(param_idx));
if (OB_SUCC(ret)) {
rt_expr->extra_ = param_idx;
rt_expr->eval_func_ = &eval_assign_question_mark_func;
} }
} else if (!IS_EXPR_OP(rt_expr->type_) || IS_AGGR_FUN(rt_expr->type_)) { } else if (!IS_EXPR_OP(rt_expr->type_) || IS_AGGR_FUN(rt_expr->type_)) {
// do nothing // do nothing

View File

@ -31,9 +31,9 @@ ObExprToOutfileRow::ObExprToOutfileRow(ObIAllocator &alloc)
{ {
need_charset_convert_ = false; need_charset_convert_ = false;
} }
ObExprToOutfileRow::~ObExprToOutfileRow() ObExprToOutfileRow::~ObExprToOutfileRow()
{ {
} }
int ObExprToOutfileRow::calc_result_typeN(ObExprResType &type, int ObExprToOutfileRow::calc_result_typeN(ObExprResType &type,
@ -102,9 +102,9 @@ int ObExprToOutfileRow::extend_buffer(ObExprOutFileInfo &out_info,
LOG_WARN("fail to allocate memory", K(ret), K(old_len), K(new_len)); LOG_WARN("fail to allocate memory", K(ret), K(old_len), K(new_len));
} else if (OB_ISNULL(out_info.tmp_buf_ = static_cast<char*>(allocator.alloc(new_len)))) { } else if (OB_ISNULL(out_info.tmp_buf_ = static_cast<char*>(allocator.alloc(new_len)))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to allocate memory", K(ret), K(old_len), K(new_len)); LOG_WARN("fail to allocate memory", K(ret), K(old_len), K(new_len));
} else { } else {
out_info.buf_len_ = new_len; out_info.buf_len_ = new_len;
out_info.tmp_buf_len_ = new_len; out_info.tmp_buf_len_ = new_len;
} }
return ret; return ret;
@ -148,9 +148,9 @@ int ObExprToOutfileRow::calc_outfile_info(const ObExpr &expr,
OZ(extract_fisrt_wchar_from_varhcar(out_info.escape_, out_info.wchar_escape_)); OZ(extract_fisrt_wchar_from_varhcar(out_info.escape_, out_info.wchar_escape_));
OZ(extend_buffer(out_info, allocator)); OZ(extend_buffer(out_info, allocator));
return ret; return ret;
} }
int ObExprToOutfileRow::to_outfile_str(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum) int ObExprToOutfileRow::to_outfile_str(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(expr.arg_cnt_ <= PARAM_SELECT_ITEM)) { if (OB_UNLIKELY(expr.arg_cnt_ <= PARAM_SELECT_ITEM)) {

View File

@ -1,3 +1,4 @@
--source mysql_test/include/explain_init.inc
--disable_query_log --disable_query_log
set @@session.explicit_defaults_for_timestamp=off; set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log --enable_query_log
@ -346,3 +347,4 @@ drop table t2;
--disable_warnings --disable_warnings
drop table if exists t2, t7, t8, t9, BB, CC; drop table if exists t2, t7, t8, t9, BB, CC;
--enable_warnings --enable_warnings
--source mysql_test/include/explain_end.inc