fix failed cases caused by udf expr compare
This commit is contained in:
@ -4304,46 +4304,49 @@ bool ObUDFRawExpr::inner_same_as(const ObRawExpr &expr,
|
||||
ObExprEqualCheckContext *check_context) const
|
||||
|
||||
{
|
||||
bool bool_ret = is_deterministic_;
|
||||
if (bool_ret) {
|
||||
bool_ret = ObSysFunRawExpr::inner_same_as(expr, check_context);
|
||||
if (bool_ret) {
|
||||
const ObUDFRawExpr *other = static_cast<const ObUDFRawExpr *>(&expr);
|
||||
bool_ret = udf_id_ == other->get_udf_id() &&
|
||||
pkg_id_ == other->get_pkg_id() &&
|
||||
type_id_ == other->get_type_id() &&
|
||||
pls_type_ == other->get_pls_type() &&
|
||||
database_name_.compare(other->get_database_name()) == 0 &&
|
||||
package_name_.compare(other->get_package_name()) == 0 &&
|
||||
is_deterministic_ == other->is_deterministic() &&
|
||||
is_parallel_enable_ == other->is_parallel_enable() &&
|
||||
is_udt_udf_ == other->get_is_udt_udf() &&
|
||||
is_pkg_body_udf_ == other->is_pkg_body_udf() &&
|
||||
is_return_sys_cursor_ == other->get_is_return_sys_cursor() &&
|
||||
is_aggregate_udf_ == other->get_is_aggregate_udf() &&
|
||||
is_aggr_udf_distinct_ == other->get_is_aggr_udf_distinct() &&
|
||||
loc_ == other->get_loc() &&
|
||||
is_udt_cons_ == other->get_is_udt_cons() &&
|
||||
subprogram_path_.count() == other->get_subprogram_path().count() &&
|
||||
params_type_.count() == other->get_params_type().count() &&
|
||||
nocopy_params_.count() == other->get_nocopy_params().count() &&
|
||||
params_name_.count() == other->get_params_name().count() &&
|
||||
params_desc_v2_.count() == other->get_params_desc().count();
|
||||
for (int64_t i = 0; bool_ret && i < subprogram_path_.count(); ++i) {
|
||||
bool_ret = subprogram_path_.at(i) == other->get_subprogram_path().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_type_.count(); ++i) {
|
||||
bool_ret = params_type_.at(i) == other->get_params_type().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < nocopy_params_.count(); ++i) {
|
||||
bool_ret = nocopy_params_.at(i) == other->get_nocopy_params().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_name_.count(); ++i) {
|
||||
bool_ret = params_name_.at(i).compare(other->get_params_name().at(i)) == 0;
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_desc_v2_.count(); ++i) {
|
||||
bool_ret = params_desc_v2_.at(i) == other->get_params_desc().at(i);
|
||||
}
|
||||
bool bool_ret = true;
|
||||
if (this == &expr) {
|
||||
// do nothing
|
||||
} else if (NULL != check_context && check_context->need_check_deterministic_ && !is_deterministic_) {
|
||||
bool_ret = false;
|
||||
} else if (!ObSysFunRawExpr::inner_same_as(expr, check_context)) {
|
||||
bool_ret = false;
|
||||
} else {
|
||||
const ObUDFRawExpr *other = static_cast<const ObUDFRawExpr *>(&expr);
|
||||
bool_ret = udf_id_ == other->get_udf_id() &&
|
||||
pkg_id_ == other->get_pkg_id() &&
|
||||
type_id_ == other->get_type_id() &&
|
||||
pls_type_ == other->get_pls_type() &&
|
||||
database_name_.compare(other->get_database_name()) == 0 &&
|
||||
package_name_.compare(other->get_package_name()) == 0 &&
|
||||
is_deterministic_ == other->is_deterministic() &&
|
||||
is_parallel_enable_ == other->is_parallel_enable() &&
|
||||
is_udt_udf_ == other->get_is_udt_udf() &&
|
||||
is_pkg_body_udf_ == other->is_pkg_body_udf() &&
|
||||
is_return_sys_cursor_ == other->get_is_return_sys_cursor() &&
|
||||
is_aggregate_udf_ == other->get_is_aggregate_udf() &&
|
||||
is_aggr_udf_distinct_ == other->get_is_aggr_udf_distinct() &&
|
||||
loc_ == other->get_loc() &&
|
||||
is_udt_cons_ == other->get_is_udt_cons() &&
|
||||
subprogram_path_.count() == other->get_subprogram_path().count() &&
|
||||
params_type_.count() == other->get_params_type().count() &&
|
||||
nocopy_params_.count() == other->get_nocopy_params().count() &&
|
||||
params_name_.count() == other->get_params_name().count() &&
|
||||
params_desc_v2_.count() == other->get_params_desc().count();
|
||||
for (int64_t i = 0; bool_ret && i < subprogram_path_.count(); ++i) {
|
||||
bool_ret = subprogram_path_.at(i) == other->get_subprogram_path().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_type_.count(); ++i) {
|
||||
bool_ret = params_type_.at(i) == other->get_params_type().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < nocopy_params_.count(); ++i) {
|
||||
bool_ret = nocopy_params_.at(i) == other->get_nocopy_params().at(i);
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_name_.count(); ++i) {
|
||||
bool_ret = params_name_.at(i).compare(other->get_params_name().at(i)) == 0;
|
||||
}
|
||||
for (int64_t i = 0; bool_ret && i < params_desc_v2_.count(); ++i) {
|
||||
bool_ret = params_desc_v2_.at(i) == other->get_params_desc().at(i);
|
||||
}
|
||||
}
|
||||
return bool_ret;
|
||||
|
||||
@ -1190,7 +1190,19 @@ struct ObExprEqualCheckContext
|
||||
recursion_level_(0),
|
||||
override_set_op_compare_(false),
|
||||
err_code_(common::OB_SUCCESS),
|
||||
param_expr_()
|
||||
param_expr_(),
|
||||
need_check_deterministic_(false)
|
||||
{ }
|
||||
ObExprEqualCheckContext(bool need_check_deterministic)
|
||||
: override_const_compare_(false),
|
||||
override_column_compare_(false),
|
||||
override_query_compare_(false),
|
||||
ignore_implicit_cast_(false),
|
||||
recursion_level_(0),
|
||||
override_set_op_compare_(false),
|
||||
err_code_(common::OB_SUCCESS),
|
||||
param_expr_(),
|
||||
need_check_deterministic_(need_check_deterministic)
|
||||
{ }
|
||||
virtual ~ObExprEqualCheckContext() {}
|
||||
struct ParamExprPair
|
||||
@ -1235,6 +1247,7 @@ struct ObExprEqualCheckContext
|
||||
override_set_op_compare_ = false;
|
||||
err_code_ = OB_SUCCESS;
|
||||
param_expr_.reset();
|
||||
need_check_deterministic_ = false;
|
||||
}
|
||||
bool override_const_compare_;
|
||||
bool override_column_compare_;
|
||||
@ -1245,6 +1258,7 @@ struct ObExprEqualCheckContext
|
||||
int err_code_;
|
||||
//when compare with T_QUESTIONMARK, as T_QUESTIONMARK is unkown, record this first.
|
||||
common::ObSEArray<ParamExprPair, 3, common::ModulePageAllocator, true> param_expr_;
|
||||
bool need_check_deterministic_;
|
||||
};
|
||||
|
||||
struct ObExprParamCheckContext : ObExprEqualCheckContext
|
||||
|
||||
Reference in New Issue
Block a user