From c92b3bbf9dc91dacd42d78949576e9a85a357053 Mon Sep 17 00:00:00 2001 From: YangEfei Date: Mon, 16 Dec 2024 05:48:16 +0000 Subject: [PATCH] [TABLELOCK] Fix the issue of precision error when the return value of the lock function is divided by other values --- src/sql/engine/expr/ob_expr_lock_func.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sql/engine/expr/ob_expr_lock_func.cpp b/src/sql/engine/expr/ob_expr_lock_func.cpp index 132c412d6..57e59681a 100644 --- a/src/sql/engine/expr/ob_expr_lock_func.cpp +++ b/src/sql/engine/expr/ob_expr_lock_func.cpp @@ -44,7 +44,9 @@ int ObExprLockFunc::calc_result_type0(ObExprResType &type, ObExprTypeCtx &type_ctx) const { int ret = OB_SUCCESS; + const ObAccuracy &res_acc = ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType]; type.set_type(ObIntType); + type.set_accuracy(res_acc); type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_NULL_ON_WARN); return ret; } @@ -54,7 +56,9 @@ int ObExprLockFunc::calc_result_type1(ObExprResType &type, ObExprTypeCtx &type_ctx) const { int ret = OB_SUCCESS; + const ObAccuracy &res_acc = ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType]; type.set_type(ObIntType); + type.set_accuracy(res_acc); type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_NULL_ON_WARN); // lock name @@ -69,7 +73,9 @@ int ObExprLockFunc::calc_result_type2(ObExprResType &type, ObExprTypeCtx &type_ctx) const { int ret = OB_SUCCESS; + const ObAccuracy &res_acc = ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType]; type.set_type(ObIntType); + type.set_accuracy(res_acc); type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_NULL_ON_WARN); // lock name