github-actions[bot] commented on code in PR #63322:
URL: https://github.com/apache/doris/pull/63322#discussion_r3254422945
##########
be/src/util/json/json_parser.h:
##########
@@ -54,15 +93,19 @@ Field getValueAsField(const Element& element) {
return
Field::create_field<TYPE_LARGEINT>(static_cast<int128_t>(element.getUInt64()));
}
if (element.isDouble()) {
+ if (auto raw_number = element.getRawNumber();
+ should_preserve_json_number_as_string(raw_number)) {
+ return Field::create_field<TYPE_STRING>(String(raw_number));
+ }
Review Comment:
This changes the parsed Field type for any JSON number that happens to have
more than 15 significant digits or at least 10 fractional digits, even when the
Variant path is not declared as a typed decimal path. For example, inserting
`{"a": 1.2345678901}` into a normal `variant` column now stores/exposes `a` as
`TYPE_STRING` instead of `TYPE_DOUBLE`, so `variant_type(v['a'])`,
serialization, comparison behavior, and later least-common-type merging can
change for existing untyped Variant data. The precision fix should preserve the
raw token separately and only use it when casting to a decimal typed path, or
otherwise keep the JSON number's Variant type numeric for untyped paths.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]