You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/12/27 12:47:30 UTC

(doris) branch branch-2.0 updated: [improve](stack_trace) avoid print stack trace in csv and json reader #28129 (#29159)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new a22aa522fff [improve](stack_trace) avoid print stack trace in csv and json reader #28129 (#29159)
a22aa522fff is described below

commit a22aa522fffdbed13fd13d2b2124f7640e33ce4d
Author: HHoflittlefish777 <77...@users.noreply.github.com>
AuthorDate: Wed Dec 27 20:47:22 2023 +0800

    [improve](stack_trace) avoid print stack trace in csv and json reader #28129 (#29159)
---
 be/src/vec/exec/format/csv/csv_reader.cpp       | 22 ++++++++++++----------
 be/src/vec/exec/format/json/new_json_reader.cpp |  8 ++++----
 2 files changed, 16 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 12a99d20b9a..ced615ec66f 100644
--- a/be/src/vec/exec/format/csv/csv_reader.cpp
+++ b/be/src/vec/exec/format/csv/csv_reader.cpp
@@ -286,7 +286,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;
@@ -419,7 +419,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);
     }
@@ -579,7 +579,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) {
@@ -610,7 +610,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;
@@ -700,7 +700,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); },
@@ -812,9 +812,10 @@ Status CsvReader::_prepare_parse(size_t* read_line, bool* is_parse_name) {
         return Status::InvalidArgument(
                 "start offset of TFileRangeDesc must be zero in get parsered schema");
     }
+
     if (_params.file_type == TFileType::FILE_STREAM ||
         _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.");
     }
@@ -917,10 +918,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();
@@ -933,10 +935,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 ff5057eedc2..e99b66b3297 100644
--- a/be/src/vec/exec/format/json/new_json_reader.cpp
+++ b/be/src/vec/exec/format/json/new_json_reader.cpp
@@ -320,7 +320,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 {
@@ -351,7 +351,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
@@ -918,7 +918,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;
@@ -1069,7 +1069,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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org