This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new f9d4690023b [improve](stack_trace) avoid print stack trace in csv and
json reader #28129
f9d4690023b is described below
commit f9d4690023b8bfb710462aabd7808978c17580b7
Author: HHoflittlefish777 <[email protected]>
AuthorDate: Thu Dec 7 22:45:18 2023 +0800
[improve](stack_trace) avoid print stack trace in csv and json reader #28129
---
be/src/vec/exec/format/csv/csv_reader.cpp | 21 +++++++++++----------
be/src/vec/exec/format/json/new_json_reader.cpp | 8 ++++----
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/be/src/vec/exec/format/csv/csv_reader.cpp
b/be/src/vec/exec/format/csv/csv_reader.cpp
index fced6bdd490..0d93fcd648c 100644
--- a/be/src/vec/exec/format/csv/csv_reader.cpp
+++ b/be/src/vec/exec/format/csv/csv_reader.cpp
@@ -283,7 +283,7 @@ Status CsvReader::init_reader(bool is_load) {
if (_file_format_type != TFileFormatType::FORMAT_CSV_PLAIN ||
(_file_compress_type != TFileCompressType::UNKNOWN &&
_file_compress_type != TFileCompressType::PLAIN)) {
- return Status::InternalError("For now we do not support split
compressed file");
+ return Status::InternalError<false>("For now we do not support
split compressed file");
}
start_offset -= 1;
_size += 1;
@@ -416,7 +416,7 @@ Status CsvReader::init_reader(bool is_load) {
_line_reader = NewPlainBinaryLineReader::create_unique(_file_reader);
break;
default:
- return Status::InternalError(
+ return Status::InternalError<false>(
"Unknown format type, cannot init line reader in csv reader,
type={}",
_file_format_type);
}
@@ -575,7 +575,7 @@ Status CsvReader::_create_decompressor() {
compress_type = CompressType::SNAPPYBLOCK;
break;
default:
- return Status::InternalError("unknown compress type: {}",
_file_compress_type);
+ return Status::InternalError<false>("unknown compress type: {}",
_file_compress_type);
}
} else {
switch (_file_format_type) {
@@ -606,7 +606,7 @@ Status CsvReader::_create_decompressor() {
compress_type = CompressType::SNAPPYBLOCK;
break;
default:
- return Status::InternalError("unknown format type: {}",
_file_format_type);
+ return Status::InternalError<false>("unknown format type: {}",
_file_format_type);
}
}
Decompressor* decompressor;
@@ -698,7 +698,7 @@ Status CsvReader::_fill_dest_columns(const Slice& line,
Block* block,
Status CsvReader::_validate_line(const Slice& line, bool* success) {
if (!_is_proto_format && !validate_utf8(line.data, line.size)) {
if (!_is_load) {
- return Status::InternalError("Only support csv data in utf8
codec");
+ return Status::InternalError<false>("Only support csv data in utf8
codec");
} else {
RETURN_IF_ERROR(_state->append_error_msg_to_file(
[&]() -> std::string { return std::string(line.data,
line.size); },
@@ -811,7 +811,7 @@ Status CsvReader::_prepare_parse(size_t* read_line, bool*
is_parse_name) {
"start offset of TFileRangeDesc must be zero in get parsered
schema");
}
if (_params.file_type == TFileType::FILE_BROKER) {
- return Status::InternalError(
+ return Status::InternalError<false>(
"Getting parsered schema from csv file do not support stream
load and broker "
"load.");
}
@@ -921,10 +921,11 @@ Status CsvReader::_parse_col_nums(size_t* col_nums) {
size_t size = 0;
RETURN_IF_ERROR(_line_reader->read_line(&ptr, &size, &_line_reader_eof,
_io_ctx));
if (size == 0) {
- return Status::InternalError("The first line is empty, can not parse
column numbers");
+ return Status::InternalError<false>(
+ "The first line is empty, can not parse column numbers");
}
if (!validate_utf8(const_cast<char*>(reinterpret_cast<const char*>(ptr)),
size)) {
- return Status::InternalError("Only support csv data in utf8 codec");
+ return Status::InternalError<false>("Only support csv data in utf8
codec");
}
_split_line(Slice(ptr, size));
*col_nums = _split_values.size();
@@ -937,10 +938,10 @@ Status
CsvReader::_parse_col_names(std::vector<std::string>* col_names) {
// no use of _line_reader_eof
RETURN_IF_ERROR(_line_reader->read_line(&ptr, &size, &_line_reader_eof,
_io_ctx));
if (size == 0) {
- return Status::InternalError("The first line is empty, can not parse
column names");
+ return Status::InternalError<false>("The first line is empty, can not
parse column names");
}
if (!validate_utf8(const_cast<char*>(reinterpret_cast<const char*>(ptr)),
size)) {
- return Status::InternalError("Only support csv data in utf8 codec");
+ return Status::InternalError<false>("Only support csv data in utf8
codec");
}
_split_line(Slice(ptr, size));
for (size_t idx = 0; idx < _split_values.size(); ++idx) {
diff --git a/be/src/vec/exec/format/json/new_json_reader.cpp
b/be/src/vec/exec/format/json/new_json_reader.cpp
index 5c62f284f96..e7944e2da86 100644
--- a/be/src/vec/exec/format/json/new_json_reader.cpp
+++ b/be/src/vec/exec/format/json/new_json_reader.cpp
@@ -306,7 +306,7 @@ Status
NewJsonReader::get_parsed_schema(std::vector<std::string>* col_names,
if (_json_doc->IsArray()) {
if (_json_doc->Size() == 0) {
// may be passing an empty json, such as "[]"
- return Status::InternalError("Empty first json line");
+ return Status::InternalError<false>("Empty first json line");
}
objectValue = &(*_json_doc)[0];
} else {
@@ -337,7 +337,7 @@ Status
NewJsonReader::get_parsed_schema(std::vector<std::string>* col_names,
Status NewJsonReader::_get_range_params() {
if (!_params.__isset.file_attributes) {
- return Status::InternalError("BE cat get file_attributes");
+ return Status::InternalError<false>("BE cat get file_attributes");
}
// get line_delimiter
@@ -821,7 +821,7 @@ Status
NewJsonReader::_write_data_to_column(rapidjson::Value::ConstValueIterator
auto* end = fmt::format_to(tmp_buf, "{}", value->GetDouble());
wbytes = end - tmp_buf;
} else {
- return Status::InternalError("It should not here.");
+ return Status::InternalError<false>("It should not here.");
}
str_value = tmp_buf;
break;
@@ -972,7 +972,7 @@ Status
NewJsonReader::_read_one_message(std::unique_ptr<uint8_t[]>* file_buf, si
break;
}
default: {
- return Status::NotSupported("no supported file reader type: {}",
_params.file_type);
+ return Status::NotSupported<false>("no supported file reader type:
{}", _params.file_type);
}
}
return Status::OK();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]