Address the issue of improper comparison due to mismatched data types on both sides of the IN expression.

This commit is contained in:
qingsuijiu
2024-06-28 12:23:58 +00:00
committed by ob-robot
parent 18bdc08688
commit e480f06bbe
2 changed files with 52 additions and 45 deletions

View File

@ -106,7 +106,8 @@ int ObExprCase::calc_result_typeN(ObExprResType &type,
types_stack[i].set_calc_meta(types_stack[i].get_obj_meta());
} else {
types_stack[i].set_calc_meta(type.get_obj_meta());
if (ObDecimalIntType == type.get_obj_meta().get_type()) {
if (ObDecimalIntType == type.get_obj_meta().get_type() ||
ob_is_double_type(type.get_obj_meta().get_type())) {
types_stack[i].set_calc_accuracy(type.get_accuracy());
}
}

View File

@ -1169,6 +1169,11 @@ int ObExprInOrNotIn::inner_eval_vector_in_without_row_fallback(const ObExpr &exp
sql::RowCmpFunc row_cmp_func = VectorCmpExprFuncsHelper::get_row_cmp_func(
expr.args_[0]->datum_meta_,
expr.args_[1]->args_[0]->datum_meta_);
if (OB_ISNULL(row_cmp_func)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("row_cmp_func is null", K(ret), K(expr.args_[0]->datum_meta_),
K(expr.args_[1]->args_[0]->datum_meta_), K(expr.args_[1]->arg_cnt_));
} else {
if (std::is_same<LeftVec, ObFixedLengthBase>::value) {
fixed_base_l_payload = (reinterpret_cast<ObFixedLengthBase *>(input_left_vec))->get_data();
l_len = (reinterpret_cast<ObFixedLengthBase *>(input_left_vec))->get_length();
@ -1223,6 +1228,7 @@ int ObExprInOrNotIn::inner_eval_vector_in_without_row_fallback(const ObExpr &exp
}
}
}
}
return ret;
}