提交 0fac1dd0 编写于 作者: S st0 提交者: LINGuanRen

fix use GCONF.enable_static_engine_for_query bug

上级 50211ed1
......@@ -3014,15 +3014,20 @@ int ObVectorExprOperator::calc_result_type2_(
{
int ret = OB_SUCCESS;
ObExprResType cmp_type;
if (OB_SUCC(calc_cmp_type2(cmp_type, type1, type2, type_ctx.get_coll_type()))) {
if (OB_ISNULL(type_ctx.get_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is null", K(ret));
} else if (OB_FAIL(calc_cmp_type2(cmp_type, type1, type2, type_ctx.get_coll_type()))) {
LOG_WARN("calc cmp type2 failed", K(ret));
} else {
type.set_int(); // not tinyint, compatiable with MySQL
type.set_calc_collation(cmp_type);
type.set_calc_type(cmp_type.get_calc_type());
ObExprOperator::calc_result_flag2(type, type1, type2);
if (GCONF.enable_static_engine_for_query()) {
obj_cmp_func func_ptr = NULL;
bool need_no_cast = ObRelationalExprOperator::can_cmp_without_cast(type1, type2, CO_EQ, func_ptr);
if (type_ctx.get_session()->use_static_typing_engine()) {
bool need_no_cast = ObRelationalExprOperator::can_cmp_without_cast(type1, type2,
CO_EQ, *type_ctx.get_session());
type1.set_calc_type(need_no_cast ? type1.get_type() : cmp_type.get_calc_type());
type2.set_calc_type(need_no_cast ? type2.get_type() : cmp_type.get_calc_type());
if (ob_is_string_type(cmp_type.get_calc_type())) {
......
......@@ -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
......
......@@ -1910,7 +1910,7 @@ int ObOpRawExpr::get_subquery_comparison_name(
void ObOpRawExpr::set_expr_type(ObItemType type)
{
type_ = type;
if ((T_OP_IN == type_ || T_OP_NOT_IN == type_) && GCONF.enable_static_engine_for_query()) {
if ((T_OP_IN == type_ || T_OP_NOT_IN == type_)) {
set_deduce_type_adding_implicit_cast(false);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册