u70b3 commented on code in PR #4971:
URL: https://github.com/apache/datafusion-comet/pull/4971#discussion_r4051935943
##########
native/spark-expr/src/string_funcs/get_json_object.rs:
##########
@@ -255,59 +276,97 @@ fn parse_json_path(path: &str) -> Option<ParsedPath> {
/// Evaluate a parsed JSONPath against a JSON string.
/// Returns the result as a string, or None if no match.
fn evaluate_path(json_str: &str, path: &ParsedPath) -> Option<String> {
- if !path.has_wildcard {
- return value_into_string(extract_no_wildcard(json_str,
&path.segments)?);
+ let mut result = extract_path(json_str, &path.segments)?;
Review Comment:
Fixed in 7099e9d2. Since serde's visitor sees an already-parsed number (the
token length is gone by `visit_f64`), the limit is enforced with a pre-parse
byte scan mirroring Jackson's `StreamReadConstraints.maxNumberLength = 1000`:
any number token longer than 1000 characters anywhere in the document returns
null, while 1000-digit tokens are accepted — including digits inside string
literals being ignored, which Jackson does not constrain.
Both sides of the boundary are covered in `get_json_object.sql` (via
`repeat('9', 1000/1001)`) and in unit tests, for wildcard and non-wildcard
paths.
One adjacent pre-existing gap, unchanged by this PR and worth recording: a
*selected* number with 309–1000 digits parses fine in Jackson (copied verbatim)
but overflows serde_json's f64 during `Value` materialization, so Comet returns
null there. Fixing that needs raw-token capture in the materialized value;
happy to file a follow-up issue if useful.
--
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]