fix some bugs
This commit is contained in:
@ -269,8 +269,9 @@ int ObExprFuncPartHash::cg_expr(ObExprCGCtx &, const ObRawExpr &, ObExpr &rt_exp
|
||||
int ret = OB_SUCCESS;
|
||||
if (lib::is_mysql_mode()) {
|
||||
if (1 != rt_expr.arg_cnt_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("expect one parameter in mysql", K(ret));
|
||||
LOG_USER_ERROR(OB_INVALID_ARGUMENT, "part hash");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -170,7 +170,16 @@ int ObExprRegexp::eval_regexp(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_
|
||||
ObDatum *text = NULL;
|
||||
ObDatum *pattern = NULL;
|
||||
if (OB_FAIL(expr.eval_param_value(ctx, text, pattern))) {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
if (ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql
|
||||
ret = OB_SUCCESS;
|
||||
expr_datum.set_null();
|
||||
const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_);
|
||||
int64_t charset_name_len = strlen(charset_name);
|
||||
const char *tmp_char = NULL;
|
||||
LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast<int>(charset_name_len), charset_name, 0, tmp_char);
|
||||
} else {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
}
|
||||
} else if (text->is_null() || pattern->is_null()) {
|
||||
expr_datum.set_null();
|
||||
} else if (OB_UNLIKELY(expr.arg_cnt_ != 2 ||
|
||||
|
||||
@ -183,7 +183,16 @@ int ObExprRegexpInstr::eval_regexp_instr(
|
||||
ObDatum *subexpr= NULL;
|
||||
if (OB_FAIL(expr.eval_param_value(
|
||||
ctx, text, pattern, position, occurrence, return_opt, match_type, subexpr))) {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql
|
||||
ret = OB_SUCCESS;
|
||||
expr_datum.set_null();
|
||||
const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_);
|
||||
int64_t charset_name_len = strlen(charset_name);
|
||||
const char *tmp_char = NULL;
|
||||
LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast<int>(charset_name_len), charset_name, 0, tmp_char);
|
||||
} else {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
}
|
||||
} else if (OB_UNLIKELY(expr.arg_cnt_ < 2 ||
|
||||
(expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI &&
|
||||
expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN &&
|
||||
|
||||
@ -141,7 +141,16 @@ int ObExprRegexpLike::eval_regexp_like(
|
||||
ObDatum *pattern = NULL;
|
||||
ObDatum *match_type = NULL;
|
||||
if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, match_type))) {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql
|
||||
ret = OB_SUCCESS;
|
||||
expr_datum.set_null();
|
||||
const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_);
|
||||
int64_t charset_name_len = strlen(charset_name);
|
||||
const char *tmp_char = NULL;
|
||||
LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast<int>(charset_name_len), charset_name, 0, tmp_char);
|
||||
} else {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
}
|
||||
} else if (OB_UNLIKELY(expr.arg_cnt_ < 2 ||
|
||||
(expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI &&
|
||||
expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN &&
|
||||
|
||||
@ -220,7 +220,16 @@ int ObExprRegexpReplace::eval_regexp_replace(
|
||||
ObEvalCtx::TempAllocGuard alloc_guard(ctx);
|
||||
ObIAllocator &tmp_alloc = alloc_guard.get_allocator();
|
||||
if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, to, position, occurrence, match_type))) {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql
|
||||
ret = OB_SUCCESS;
|
||||
expr_datum.set_null();
|
||||
const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_);
|
||||
int64_t charset_name_len = strlen(charset_name);
|
||||
const char *tmp_char = NULL;
|
||||
LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast<int>(charset_name_len), charset_name, 0, tmp_char);
|
||||
} else {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
}
|
||||
} else if (lib::is_oracle_mode() && pattern->is_null()) {
|
||||
if (text->is_null()) {
|
||||
expr_datum.set_null();
|
||||
|
||||
@ -197,7 +197,16 @@ int ObExprRegexpSubstr::eval_regexp_substr(
|
||||
int64_t occur = 1;
|
||||
int64_t subexpr_val = 0;
|
||||
if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, position, occurrence, match_type, subexpr))) {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql
|
||||
ret = OB_SUCCESS;
|
||||
expr_datum.set_null();
|
||||
const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_);
|
||||
int64_t charset_name_len = strlen(charset_name);
|
||||
const char *tmp_char = NULL;
|
||||
LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast<int>(charset_name_len), charset_name, 0, tmp_char);
|
||||
} else {
|
||||
LOG_WARN("evaluate parameters failed", K(ret));
|
||||
}
|
||||
} else if (OB_UNLIKELY(expr.arg_cnt_ < 2 ||
|
||||
(expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI &&
|
||||
expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN &&
|
||||
|
||||
Reference in New Issue
Block a user