From 04d918a5625f6b1e663a0c8c4b025833fac8366b Mon Sep 17 00:00:00 2001 From: qingsuijiu <642782632@qq.com> Date: Tue, 9 Jul 2024 05:21:10 +0000 Subject: [PATCH] Solve the problem of scale misalignment when the parameter type of the IN expression is double. --- src/sql/engine/expr/ob_expr_in.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sql/engine/expr/ob_expr_in.cpp b/src/sql/engine/expr/ob_expr_in.cpp index 22a777e299..4835757a3e 100644 --- a/src/sql/engine/expr/ob_expr_in.cpp +++ b/src/sql/engine/expr/ob_expr_in.cpp @@ -480,6 +480,21 @@ int ObExprInOrNotIn::calc_result_typeN(ObExprResType &type, { int ret = ObVectorExprOperator::calc_result_typeN(type, types, param_num, type_ctx); if (OB_SUCC(ret)) { + if (ob_is_double_type(types[0].get_calc_type())) { + common::ObScale double_scale = 0; + int calc_scale_done = false; + for (int64_t i = 0; i < param_num && !calc_scale_done; ++i) { + if (types[i].get_calc_scale() == -1) { + double_scale = -1; + calc_scale_done = true; + } else if (types[i].get_calc_scale() > double_scale) { + double_scale = types[i].get_calc_scale(); + } + } + for (int64_t i = 0; i < param_num; ++i) { + types[i].set_calc_scale(double_scale); + } + } type.set_scale(DEFAULT_SCALE_FOR_INTEGER); type.set_precision(DEFAULT_PRECISION_FOR_BOOL); }