add inner_same_as for udf func and remove useless GET_MIN_CLUSTER_VERSION
This commit is contained in:
@ -607,46 +607,21 @@ int ObExprCast::do_implicit_cast(ObExprCtx &expr_ctx,
|
||||
OB_DEF_SERIALIZE(ObExprCast)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_implicit_cast = (1 == extra_serialize_);
|
||||
// ObExprCast最初没有定义自己的序列化方法,后来在2273中添加了序列化方法,导致序列化buf发生如下变化
|
||||
// [ObExprOperator_ser_len, ObExprOperator_ser_data] =>
|
||||
// [ObExprCast_ser_len, [ObExprOperator_ser_len, ObExprOperator_ser_data], is_implicit_cast_]
|
||||
// 导致与老版本不兼容。
|
||||
// 为了与各个版本兼容这里做了版本判断,如果最小版本为2273,那么使用与2273兼容的序列化逻辑,
|
||||
// 否则仍使用ObExprOperator的序列化逻辑
|
||||
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
|
||||
BASE_SER((ObExprCast, ObFuncExprOperator));
|
||||
OB_UNIS_ENCODE(is_implicit_cast);
|
||||
} else {
|
||||
ret = ObExprOperator::serialize_(buf, buf_len, pos);
|
||||
}
|
||||
ret = ObExprOperator::serialize_(buf, buf_len, pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
OB_DEF_DESERIALIZE(ObExprCast)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
|
||||
bool is_implicit_cast = false;
|
||||
BASE_DESER((ObExprCast, ObFuncExprOperator));
|
||||
OB_UNIS_DECODE(is_implicit_cast);
|
||||
extra_serialize_ = is_implicit_cast ? 1 : 0;
|
||||
} else {
|
||||
ret = ObExprOperator::deserialize_(buf, data_len, pos);
|
||||
}
|
||||
ret = ObExprOperator::deserialize_(buf, data_len, pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
OB_DEF_SERIALIZE_SIZE(ObExprCast)
|
||||
{
|
||||
int64_t len = 0;
|
||||
if (CLUSTER_VERSION_2273 == GET_MIN_CLUSTER_VERSION()) {
|
||||
bool is_implicit_cast = false;
|
||||
BASE_ADD_LEN((ObExprCast, ObFuncExprOperator));
|
||||
OB_UNIS_ADD_LEN(is_implicit_cast);
|
||||
} else {
|
||||
len = ObExprOperator::get_serialize_size_();
|
||||
}
|
||||
len = ObExprOperator::get_serialize_size_();
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@ -136,13 +136,9 @@ int ObExprColumnConv::convert_with_null_check(ObObj &result,
|
||||
if (OB_FAIL(ObExprColumnConv::convert_skip_null_check(result, obj, res_type, is_strict,
|
||||
cast_ctx, type_infos))) {
|
||||
LOG_WARN("fail to convert skip null check", K(ret));
|
||||
} else {
|
||||
// if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2220) {
|
||||
if (is_not_null && (result.is_null() || (lib::is_oracle_mode() && result.is_null_oracle()))) {
|
||||
ret = OB_BAD_NULL_ERROR;
|
||||
LOG_WARN("Column should not be null", K(ret));
|
||||
// }
|
||||
}
|
||||
} else if (is_not_null && (result.is_null() || (lib::is_oracle_mode() && result.is_null_oracle()))) {
|
||||
ret = OB_BAD_NULL_ERROR;
|
||||
LOG_WARN("Column should not be null", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -48,16 +48,7 @@ ObSqlExpression::~ObSqlExpression()
|
||||
int ObSqlExpression::set_item_count(int64_t count)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (ObSqlExpressionUtil::should_gen_postfix_expr()) {
|
||||
if (OB_FAIL(post_expr_.set_item_count(count))) {
|
||||
LOG_WARN("failed to set item count", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(infix_expr_.set_item_count(count))) {
|
||||
if (OB_FAIL(infix_expr_.set_item_count(count))) {
|
||||
LOG_WARN("set expr item count failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
@ -166,13 +157,6 @@ int ObSqlExpression::calc(ObExprCtx &expr_ctx, const common::ObNewRow &row1,
|
||||
int ObSqlExpression::generate_idx_for_regexp_ops(int16_t &cur_regexp_op_count)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (ObSqlExpressionUtil::should_gen_postfix_expr()) {
|
||||
if (OB_FAIL(post_expr_.generate_idx_for_regexp_ops(cur_regexp_op_count))) {
|
||||
LOG_WARN("generate idx for regexp failed", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(infix_expr_.generate_idx_for_regexp_ops(cur_regexp_op_count))) {
|
||||
LOG_WARN("generate idx for regexp failed", K(ret));
|
||||
}
|
||||
@ -610,15 +594,5 @@ int ObSqlExpressionUtil::expand_array_params(ObExprCtx &expr_ctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObSqlExpressionUtil::should_gen_postfix_expr()
|
||||
{
|
||||
bool bool_ret = false;
|
||||
if (GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_2230) {
|
||||
bool_ret = true;
|
||||
} else {
|
||||
bool_ret = false;
|
||||
}
|
||||
return bool_ret;
|
||||
}
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
@ -399,7 +399,6 @@ public:
|
||||
static int expand_array_params(common::ObExprCtx &expr_ctx,
|
||||
const common::ObObj &src_param,
|
||||
const common::ObObj *&result);
|
||||
static bool should_gen_postfix_expr();
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObSqlExpressionUtil);
|
||||
ObSqlExpressionUtil();
|
||||
|
||||
Reference in New Issue
Block a user