This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 0f83c3002d8c4a40315895222bf6197e31de03e9
Author: Liqf <[email protected]>
AuthorDate: Fri Sep 22 12:23:43 2023 +0800

    [bug](jsonb) fix non simd int128 overflow #24750
---
 be/src/util/jsonb_parser.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/be/src/util/jsonb_parser.h b/be/src/util/jsonb_parser.h
index 8d29b52faf1..1591fa563c7 100644
--- a/be/src/util/jsonb_parser.h
+++ b/be/src/util/jsonb_parser.h
@@ -899,8 +899,8 @@ private:
 
         *pbuf = 0; // set null-terminator
         StringParser::ParseResult parse_result = StringParser::PARSE_SUCCESS;
-        int64_t val =
-                StringParser::string_to_int<int64_t>(num_buf_, pbuf - 
num_buf_, &parse_result);
+        int128_t val =
+                StringParser::string_to_int<int128_t>(num_buf_, pbuf - 
num_buf_, &parse_result);
         if (parse_result != StringParser::PARSE_SUCCESS) {
             VLOG_ROW << "debug string_to_int error for " << num_buf_ << " 
val=" << val
                      << " parse_result=" << parse_result;
@@ -918,8 +918,11 @@ private:
         } else if (val >= std::numeric_limits<int32_t>::min() &&
                    val <= std::numeric_limits<int32_t>::max()) {
             size = writer_.writeInt32((int32_t)val);
-        } else { // val <= INT64_MAX
-            size = writer_.writeInt64(val);
+        } else if (val >= std::numeric_limits<int64_t>::min() &&
+                   val <= std::numeric_limits<int64_t>::max()) {
+            size = writer_.writeInt64((int64_t)val);
+        } else { // INT128
+            size = writer_.writeInt128(val);
         }
 
         if (size == 0) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to