hello-stephen commented on code in PR #71093:
URL: https://github.com/apache/doris/pull/71093#discussion_r4735985515
##########
be/src/exprs/json_functions.cpp:
##########
@@ -247,7 +248,12 @@ void JsonFunctions::get_parsed_paths(const
std::vector<std::string>& path_exprs,
if (index == "*") {
idx = -2;
} else {
- idx = atoi(index.c_str());
+ // Parse before storing the index. For example, 4294967296
must not select element 0.
+ auto result = std::from_chars(index.data(), index.data() +
index.size(), idx);
+ if (result.ec != std::errc()) {
+ throw Exception(ErrorCode::INVALID_JSON_PATH,
Review Comment:
[P1] Catch overflow exceptions before leaving schema inference
For a readable nonempty JSON file, a JSON TVF using
`jsonpaths='["$.a[4294967296]"]'` (or an overflowing `json_root`) reaches this
new throw through `fetch_table_schema -> fetch_file_schema ->
JsonReader::infer_schema -> _parse_jsonpath_and_json_root`. None of those
callers catches `doris::Exception`: `internal_service.cpp:928` invokes schema
inference in `_heavy_work_pool`, whose callback runs directly on `std::thread`
(`work_thread_pool.hpp:162`, `thread_group.h:65`). The exception therefore
escapes the thread entry and terminates the BE. Please convert it to a non-OK
`Status` on the reader/schema-RPC path and add an overflow schema-inference
test; the new parser-only `EXPECT_THROW` does not cover this caller.
--
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]