fix use GCONF.enable_static_engine_for_query bug

This commit is contained in:
st0
2021-12-01 16:27:51 +08:00
committed by LINxiansheng
parent 50211ed1ef
commit 0fac1dd0b9
3 changed files with 12 additions and 35 deletions

View File

@ -1000,33 +1000,8 @@ public:
return ret;
}
static int get_equal_meta(common::ObObjMeta& meta, const common::ObObjMeta& meta1, const common::ObObjMeta& meta2);
OB_INLINE static bool can_cmp_without_cast(
const ObExprResType& type1, const ObExprResType& type2, common::ObCmpOp cmp_op, common::obj_cmp_func& cmp_func)
{
bool need_no_cast = false;
// Special processing shows that compare is called (for example: c1> c2),
// at this time enum/set should be converted to string processing.
// Internal comparison (order by), enum/set does not need to be converted.
if (GCONF.enable_static_engine_for_query()) {
if (common::ObDatumFuncs::is_string_type(type1.get_type()) &&
common::ObDatumFuncs::is_string_type(type2.get_type())) {
need_no_cast = common::ObCharset::charset_type_by_coll(type1.get_collation_type()) ==
common::ObCharset::charset_type_by_coll(type2.get_collation_type());
} else {
auto func_ptr = ObExprCmpFuncsHelper::get_eval_expr_cmp_func(
type1.get_type(), type2.get_type(), cmp_op, lib::is_oracle_mode(), common::CS_TYPE_MAX);
need_no_cast = (func_ptr != nullptr);
}
} else if (common::ob_is_enum_or_set_type(type1.get_type())
&& common::ob_is_enum_or_set_type(type2.get_type())) {
need_no_cast = false;
} else {
need_no_cast = common::ObObjCmpFuncs::can_cmp_without_cast(type1, type2, cmp_op, cmp_func);
}
return need_no_cast;
}
static bool can_cmp_without_cast(
const ObExprResType& type1, const ObExprResType& type2, common::ObCmpOp cmp_op, const ObSQLSessionInfo& session);
protected:
static bool is_int_cmp_const_str(const ObExprResType* type1, const ObExprResType* type2, common::ObObjType& cmp_type);
@ -1116,9 +1091,6 @@ protected:
return common::ObObjCmpFuncs::compare(result, obj1, obj2, cmp_ctx, cmp_op, cmp_func);
}
static bool can_cmp_without_cast(
const ObExprResType& type1, const ObExprResType& type2, common::ObCmpOp cmp_op, const ObSQLSessionInfo& session);
protected:
// only use for comparison with 2 operands(calc_result2)
// if cmp_op_func2_ is not NULL, that means we can compare the 2 objs directly without any casts