From 51a269bf730b283fb865673351a908ce3bc50288 Mon Sep 17 00:00:00 2001 From: hezuojiao Date: Mon, 13 Feb 2023 03:14:55 +0000 Subject: [PATCH] Fix zerofill double calc hash inconsistent --- src/sql/engine/expr/ob_expr_cast.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/engine/expr/ob_expr_cast.cpp b/src/sql/engine/expr/ob_expr_cast.cpp index b05e9ba655..bba1c81d69 100644 --- a/src/sql/engine/expr/ob_expr_cast.cpp +++ b/src/sql/engine/expr/ob_expr_cast.cpp @@ -743,7 +743,10 @@ int ObExprCast::cg_expr(ObExprCGCtx &op_cg_ctx, if (OB_UNLIKELY(UINT_MAX8 < src_res_type.get_length())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected zerofill length", K(ret), K(src_res_type.get_length())); - } else { + } else if (ob_is_string_or_lob_type(out_type)) { + // The zerofill information will only be used when cast to string/lob type. + // for these types, scale is unused, so the previous design is to save child length + // to the scale of the rt_expr. rt_expr.datum_meta_.scale_ = static_cast(src_res_type.get_length()); } }