eldenmoon commented on code in PR #48196:
URL: https://github.com/apache/doris/pull/48196#discussion_r1965536730
##########
be/src/vec/exec/format/json/new_json_reader.cpp:
##########
@@ -1164,8 +1164,31 @@ Status
NewJsonReader::_read_one_message(std::unique_ptr<uint8_t[]>* file_buf, si
break;
}
case TFileType::FILE_STREAM: {
- RETURN_IF_ERROR((dynamic_cast<io::StreamLoadPipe*>(_file_reader.get()))
- ->read_one_message(file_buf, read_size));
+ // StreamLoadPipe::read_one_message only reads a portion of the data
when stream loading with a chunked transfer HTTP request.
+ // Need to read all the data before performing JSON parsing
+ uint64_t buffer_size = 1024 * 1024;
+ std::vector<uint8_t> buf(buffer_size);
+
+ uint64_t cur_size = 0;
+ while (true) {
+
RETURN_IF_ERROR((dynamic_cast<io::StreamLoadPipe*>(_file_reader.get()))
+ ->read_one_message(file_buf, read_size));
+
+ if (*read_size == 0) {
+ break;
+ } else {
+ if (cur_size + (*read_size) > buf.size()) {
+ buffer_size = 2 * (cur_size + (*read_size));
+ buf.resize(buffer_size);
+ }
+ memcpy(buf.data() + cur_size, file_buf->get(), *read_size);
Review Comment:
direct copy to file_buf
--
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]