[fix](json) fix json int128 overflow (#22917)

* support int128 in jsonb

* fix jsonb int128 write

* fix jsonb to json int128

* fix json functions for int128

* add nereids function jsonb_extract_largeint

* add testcase for json int128

* change docs for json int128

* add nereids function jsonb_extract_largeint

* clang format

* fix check style

* using int128_t = __int128_t for all int128

* use fmt::format_to instead of snprintf digit by digit for int128

* clang format

* delete useless check

* add warn log

* clang format
This commit is contained in:
Kang
2023-08-25 11:40:30 +08:00
committed by GitHub
parent 372f83df5c
commit 8ef6b4d996
20 changed files with 2972 additions and 36 deletions

View File

@ -17,6 +17,8 @@
#include "runtime/jsonb_value.h"
#include <fmt/format.h>
#include <string_view>
#include "util/jsonb_error.h"
@ -30,8 +32,10 @@ Status JsonBinaryValue::from_json_string(const char* s, int length) {
JsonbErrType error = JsonbErrType::E_NONE;
if (!parser.parse(s, length)) {
error = parser.getErrorCode();
return Status::InvalidArgument("json parse error: {} for value: {}",
JsonbErrMsg::getErrMsg(error), std::string_view(s, length));
auto msg = fmt::format("json parse error: {} for value: {}", JsonbErrMsg::getErrMsg(error),
std::string_view(s, length));
LOG(WARNING) << msg;
return Status::InvalidArgument(msg);
}
ptr = parser.getWriter().getOutput()->getBuffer();