This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 8ad50bf [Bug] Fix bug that BE core will loading empty json array
(#5349)
8ad50bf is described below
commit 8ad50bf74572b78eeb93ca6a7c556bb364e755ee
Author: Mingyu Chen <[email protected]>
AuthorDate: Sun Feb 7 22:38:15 2021 +0800
[Bug] Fix bug that BE core will loading empty json array (#5349)
When loading json data like `[]` (an empty array). BE will crash with stack:
```
*** Aborted at 1612273824 (unix time) try "date -d @1612273824" if you are
using GNU date ***
PC: @ 0xe0cce7 rapidjson::GenericValue<>::Accept<>()
*** SIGSEGV (@0xe) received by PID 36798 (TID 0x7f7812114700) from PID 14;
stack trace: ***
@ 0x7f791b74b470 (unknown)
@ 0xe0cce7 rapidjson::GenericValue<>::Accept<>()
@ 0x169ff79
_ZN5doris10JsonReader17_print_json_valueB5cxx11ERKN9rapidjson12GenericValueINS1_4UTF8IcEENS1_19MemoryPoolAllocatorINS1_12CrtAllocatorEEEEE
@ 0x16a0689 doris::JsonReader::_write_values_by_jsonpath()
@ 0x16a2cb4
doris::JsonReader::_handle_flat_array_complex_json()
@ 0x16a3761 doris::JsonScanner::get_next()
@ 0x1659bd4 doris::BrokerScanNode::scanner_scan()
@ 0x165a671 doris::BrokerScanNode::scanner_worker()
@ 0x281f67f execute_native_thread_routine
@ 0x7f791b5001c3 start_thread
@ 0x7f791b7fd12d __clone
```
---
be/src/exec/json_scanner.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/be/src/exec/json_scanner.cpp b/be/src/exec/json_scanner.cpp
index faba55d..2770435 100644
--- a/be/src/exec/json_scanner.cpp
+++ b/be/src/exec/json_scanner.cpp
@@ -666,6 +666,11 @@ Status JsonReader::_handle_flat_array_complex_json(Tuple*
tuple,
}
_total_lines = _json_doc->Size();
_next_line = 0;
+
+ if (_total_lines == 0) {
+ // meet an empty json array.
+ continue;
+ }
}
rapidjson::Value& objectValue = (*_json_doc)[_next_line++];
if (!_write_values_by_jsonpath(objectValue, tuple_pool, tuple,
slot_descs)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]