github-actions[bot] commented on code in PR #63322:
URL: https://github.com/apache/doris/pull/63322#discussion_r3256376020
##########
be/src/util/json/json_parser.cpp:
##########
@@ -84,8 +89,29 @@ void JSONDataParser<ParserImpl>::traverse(const Element&
element, ParseContext&
// we should set has_nested_in_flatten to false when traverse array
finished for next array otherwise it will be true for next array
ctx.has_nested_in_flatten = false;
} else {
- appendValueIfNotDuplicate(ctx, ctx.builder.get_parts(),
getValueAsField(element));
+ appendValueIfNotDuplicate(ctx, ctx.builder.get_parts(),
+ getValueAsField(element,
shouldPreserveNumberAsString(ctx)));
+ }
Review Comment:
The raw-number decision is only used on the scalar `Field` path. When an
array contains objects and `deprecated_enable_flatten_nested` is false, the
branch above serializes the whole array with `traverseArrayAsJsonb()` instead
of recursing to leaf paths; `writeValueAsJsonb()` still writes floating-point
numbers via `writer.writeDouble(element.getDouble())`. A predefined decimal
path inside an array of objects, for example `items.price` with JSON
`{"items":[{"price":999999999999999999999999999.999999999}]}`, can therefore be
rounded before the storage-layer nested expansion/materialization casts it to
decimal. Please preserve raw numeric text in the JSONB serialization path for
configured decimal typed paths as well, or avoid routing those typed paths
through lossy JSONB serialization, and add a regression with a predefined
decimal inside an array of objects.
--
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]