This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 55c26e03e5f [Enhancement](Log) Reduce usage of log fatal(PART I)
(#42344)
55c26e03e5f is described below
commit 55c26e03e5f76fe80e6bedd2bc31760e55cd6707
Author: linrrarity <[email protected]>
AuthorDate: Thu Dec 19 20:04:15 2024 +0800
[Enhancement](Log) Reduce usage of log fatal(PART I) (#42344)
## Proposed changes
Issue Number: close #40835
<!--Describe your changes.-->
use `throw Exception` to replace them which not in `if constexpr`, and
change part of `INTERNAL_ERROR` in this
[pr](https://github.com/apache/doris/pull/38144/files)(file
`aggregate_function_reader_first_last.h` and
`aggregate_function_window.h`) to `FatalError`.
for those in `if constexpr else{...}`, use `static_assert` about
template argument which used in that judgement to advance them to
compile time
but there seems to be some bugs with the template parameter
instantiation in the files `comparison_predicate.h`,
`set_probe_sink_operator.cpp`, `set_sink_operator.cpp`,
`comparison_predicate.h`, `in_list_predicate.h` and
`set_source_operator.cpp` that I haven't modified yet.
---------
Co-authored-by: wyxxxcat <[email protected]>
---
be/src/common/status.h | 11 ++++-
be/src/gutil/strings/escaping.cc | 5 +-
be/src/gutil/strings/numbers.cc | 6 ++-
be/src/gutil/strings/util.cc | 5 +-
be/src/gutil/threading/thread_collision_warner.cc | 8 +++-
be/src/io/file_factory.h | 5 +-
be/src/olap/block_column_predicate.h | 12 ++---
be/src/olap/data_dir.cpp | 16 +++----
be/src/olap/key_coder.h | 13 ++---
be/src/olap/like_column_predicate.h | 8 ++--
be/src/olap/match_predicate.h | 3 +-
be/src/olap/null_predicate.h | 4 +-
be/src/olap/olap_common.h | 6 ++-
be/src/olap/page_cache.h | 6 +--
be/src/olap/rowset/beta_rowset_writer_v2.h | 3 +-
be/src/olap/rowset/rowset_writer.h | 4 +-
.../rowset/segment_v2/hierarchical_data_reader.cpp | 6 +--
be/src/olap/storage_policy.cpp | 6 ++-
be/src/olap/tablet_reader.cpp | 2 +-
be/src/pipeline/dependency.h | 3 +-
be/src/pipeline/exec/exchange_sink_buffer.cpp | 3 +-
be/src/pipeline/exec/exchange_sink_buffer.h | 5 +-
be/src/pipeline/exec/hashjoin_build_sink.cpp | 4 +-
be/src/pipeline/exec/operator.cpp | 3 +-
be/src/pipeline/exec/operator.h | 6 +--
be/src/runtime/exec_env_init.cpp | 10 ++--
be/src/runtime/jsonb_value.h | 33 +++++--------
be/src/runtime/memory/cache_manager.h | 3 +-
be/src/runtime/memory/cache_policy.h | 6 +--
be/src/runtime/memory/lru_cache_policy.h | 3 +-
be/src/runtime/memory/thread_mem_tracker_mgr.h | 4 +-
be/src/runtime/snapshot_loader.cpp | 5 +-
.../runtime/stream_load/stream_load_executor.cpp | 3 +-
be/src/runtime/thread_context.h | 7 ++-
be/src/util/binary_cast.hpp | 3 +-
be/src/util/bit_util.h | 4 +-
be/src/util/bitmap_value.h | 3 +-
be/src/util/block_compression.cpp | 3 +-
be/src/util/easy_json.cc | 5 +-
be/src/util/jsonb_utils.h | 4 +-
be/src/util/rle_encoding.h | 2 +-
be/src/util/threadpool.cpp | 11 +++--
be/src/util/timezone_utils.cpp | 4 +-
.../aggregate_functions/aggregate_function_map.h | 5 +-
.../aggregate_function_reader_first_last.h | 17 ++-----
.../aggregate_function_window.h | 19 +++-----
be/src/vec/columns/column_string.cpp | 10 ++--
be/src/vec/common/assert_cast.h | 19 ++++----
be/src/vec/common/hash_table/string_hash_table.h | 3 +-
be/src/vec/common/schema_util.cpp | 5 +-
be/src/vec/core/block.cpp | 4 +-
be/src/vec/core/decimal_comparison.h | 23 ++++-----
be/src/vec/core/field.h | 56 ++++++++++------------
be/src/vec/core/types.h | 3 +-
be/src/vec/data_types/data_type_number_base.cpp | 3 +-
be/src/vec/data_types/data_type_number_base.h | 3 +-
be/src/vec/data_types/serde/data_type_serde.h | 5 +-
.../vec/exec/format/parquet/bool_rle_decoder.cpp | 9 ++--
be/src/vec/exec/format/parquet/decoder.h | 4 +-
.../exec/format/parquet/delta_bit_pack_decoder.h | 10 ++--
.../exec/format/parquet/parquet_column_convert.h | 9 ++--
.../exec/format/parquet/vparquet_column_reader.h | 4 +-
be/src/vec/exec/jni_connector.cpp | 4 +-
be/src/vec/exec/scan/split_source_connector.h | 6 ++-
be/src/vec/exprs/vexpr.h | 12 ++---
.../vec/functions/array/function_array_apply.cpp | 4 +-
be/src/vec/functions/function_cast.h | 12 +++--
be/src/vec/json/simd_json_parser.h | 4 +-
be/src/vec/olap/olap_data_convertor.h | 6 ++-
be/src/vec/runtime/vdatetime_value.cpp | 6 +--
be/test/util/threadpool_test.cpp | 1 +
71 files changed, 250 insertions(+), 282 deletions(-)
diff --git a/be/src/common/status.h b/be/src/common/status.h
index d059f289402..0252ec8564f 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -293,7 +293,8 @@ namespace ErrorCode {
E(ENTRY_NOT_FOUND, -7002, false); \
E(INVALID_TABLET_STATE, -7211, false); \
E(ROWSETS_EXPIRED, -7311, false); \
- E(CGROUP_ERROR, -7411, false);
+ E(CGROUP_ERROR, -7411, false); \
+ E(FATAL_ERROR, -7412, false);
// Define constexpr int error_code_name = error_code_value
#define M(NAME, ERRORCODE, ENABLESTACKTRACE) constexpr int NAME = ERRORCODE;
@@ -446,6 +447,14 @@ public:
static Status OK() { return {}; }
+ template <bool stacktrace = true, typename... Args>
+ static Status FatalError(std::string_view msg, Args&&... args) {
+#ifndef NDEBUG
+ LOG(FATAL) << fmt::format(msg, std::forward<Args>(args)...);
+#endif
+ return Error<ErrorCode::FATAL_ERROR, stacktrace>(msg,
std::forward<Args>(args)...);
+ }
+
// default have stacktrace. could disable manually.
#define ERROR_CTOR(name, code)
\
template <bool stacktrace = true, typename... Args>
\
diff --git a/be/src/gutil/strings/escaping.cc b/be/src/gutil/strings/escaping.cc
index 2ff59104f6d..c6ba8e2f9c3 100644
--- a/be/src/gutil/strings/escaping.cc
+++ b/be/src/gutil/strings/escaping.cc
@@ -10,6 +10,8 @@
#include <limits>
#include <ostream>
+#include "common/exception.h"
+
using std::numeric_limits;
#include <vector>
@@ -1084,7 +1086,8 @@ int Base64UnescapeInternal(const char* src, int szsrc,
char* dest, int szdest,
default:
// state should have no other values at this point.
- LOG(FATAL) << "This can't happen; base64 decoder state = " << state;
+ throw doris::Exception(
+ doris::Status::FatalError("This can't happen; base64 decoder
state = {}", state));
}
// The remainder of the string should be all whitespace, mixed with
diff --git a/be/src/gutil/strings/numbers.cc b/be/src/gutil/strings/numbers.cc
index f471bf31bd0..f044ea08d31 100644
--- a/be/src/gutil/strings/numbers.cc
+++ b/be/src/gutil/strings/numbers.cc
@@ -19,6 +19,8 @@
#include <limits>
#include <ostream>
+#include "common/exception.h"
+
using std::numeric_limits;
#include <string>
@@ -772,8 +774,8 @@ uint64 atoi_kmgt(const char* s) {
scale = GG_ULONGLONG(1) << 40;
break;
default:
- LOG(FATAL) << "Invalid mnemonic: `" << c << "';"
- << " should be one of `K', `M', `G', and `T'.";
+ throw doris::Exception(doris::Status::FatalError(
+ "Invalid mnemonic: `{}'; should be one of `K', `M', `G',
and `T'.", c));
}
}
return n * scale;
diff --git a/be/src/gutil/strings/util.cc b/be/src/gutil/strings/util.cc
index 80d5d463430..37c09d63b24 100644
--- a/be/src/gutil/strings/util.cc
+++ b/be/src/gutil/strings/util.cc
@@ -19,6 +19,8 @@
#include <mutex>
#include <ostream>
+#include "common/exception.h"
+
using std::copy;
using std::max;
using std::min;
@@ -489,8 +491,7 @@ const char* strstr_delimited(const char* haystack, const
char* needle, char deli
++haystack;
}
}
- LOG(FATAL) << "Unreachable statement";
- return nullptr;
+ throw doris::Exception(doris::Status::FatalError("Unreachable statement"));
}
// ----------------------------------------------------------------------
diff --git a/be/src/gutil/threading/thread_collision_warner.cc
b/be/src/gutil/threading/thread_collision_warner.cc
index d2f1e47f8e0..fd51a9195d6 100644
--- a/be/src/gutil/threading/thread_collision_warner.cc
+++ b/be/src/gutil/threading/thread_collision_warner.cc
@@ -4,6 +4,9 @@
#include "gutil/threading/thread_collision_warner.h"
+#include "common/exception.h"
+#include "common/status.h"
+
#ifdef __linux__
#include <syscall.h>
#else
@@ -19,8 +22,9 @@
namespace base {
void DCheckAsserter::warn(int64_t previous_thread_id, int64_t
current_thread_id) {
- LOG(FATAL) << "Thread Collision! Previous thread id: " <<
previous_thread_id
- << ", current thread id: " << current_thread_id;
+ throw doris::Exception(doris::Status::FatalError(
+ "Thread Collision! Previous thread id: {}, current thread id: {}",
previous_thread_id,
+ current_thread_id));
}
static subtle::Atomic64 CurrentThread() {
diff --git a/be/src/io/file_factory.h b/be/src/io/file_factory.h
index 9d9d714812f..afa54e22166 100644
--- a/be/src/io/file_factory.h
+++ b/be/src/io/file_factory.h
@@ -118,10 +118,9 @@ public:
case TStorageBackendType::HDFS:
return TFileType::FILE_HDFS;
default:
- LOG(FATAL) << "not match type to convert, from type:" << type;
+ throw Exception(Status::FatalError("not match type to convert,
from type:{}", type));
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
};
diff --git a/be/src/olap/block_column_predicate.h
b/be/src/olap/block_column_predicate.h
index eed5e18329a..b6ff115c34c 100644
--- a/be/src/olap/block_column_predicate.h
+++ b/be/src/olap/block_column_predicate.h
@@ -74,25 +74,21 @@ public:
}
virtual bool can_do_apply_safely(PrimitiveType input_type, bool is_null)
const {
- LOG(FATAL) << "should not reach here";
- return true;
+ throw Exception(Status::FatalError("should not reach here"));
}
virtual bool support_zonemap() const { return true; }
virtual bool evaluate_and(const std::pair<WrapperField*, WrapperField*>&
statistic) const {
- LOG(FATAL) << "should not reach here";
- return true;
+ throw Exception(Status::FatalError("should not reach here"));
}
virtual bool evaluate_and(const segment_v2::BloomFilter* bf) const {
- LOG(FATAL) << "should not reach here";
- return true;
+ throw Exception(Status::FatalError("should not reach here"));
}
virtual bool evaluate_and(const StringRef* dict_words, const size_t
dict_num) const {
- LOG(FATAL) << "should not reach here";
- return true;
+ throw Exception(Status::FatalError("should not reach here"));
}
virtual bool can_do_bloom_filter(bool ngram) const { return false; }
diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp
index 4070bd1dd43..4aa215e0c2e 100644
--- a/be/src/olap/data_dir.cpp
+++ b/be/src/olap/data_dir.cpp
@@ -316,10 +316,10 @@ Status DataDir::_check_incompatible_old_format_tablet() {
std::string_view value) -> bool {
// if strict check incompatible old format, then log fatal
if (config::storage_strict_check_incompatible_old_format) {
- LOG(FATAL)
- << "There are incompatible old format metas, current
version does not support "
- << "and it may lead to data missing!!! "
- << "tablet_id = " << tablet_id << " schema_hash = " <<
schema_hash;
+ throw Exception(Status::FatalError(
+ "There are incompatible old format metas, current version
does not support and "
+ "it may lead to data missing!!! tablet_id = {} schema_hash
= {}",
+ tablet_id, schema_hash));
} else {
LOG(WARNING)
<< "There are incompatible old format metas, current
version does not support "
@@ -451,7 +451,8 @@ Status DataDir::load() {
<< ", loaded tablet: " << tablet_ids.size()
<< ", error tablet: " << failed_tablet_ids.size() << ",
path: " << _path;
if (!config::ignore_load_tablet_failure) {
- LOG(FATAL) << "load tablets encounter failure. stop BE process.
path: " << _path;
+ throw Exception(Status::FatalError(
+ "load tablets encounter failure. stop BE process. path:
{}", _path));
}
}
if (!load_tablet_status) {
@@ -495,10 +496,9 @@ Status DataDir::load() {
}
}
if (rowset_partition_id_eq_0_num >
config::ignore_invalid_partition_id_rowset_num) {
- LOG(FATAL) << fmt::format(
+ throw Exception(Status::FatalError(
"roswet partition id eq 0 is {} bigger than config {}, be
exit, plz check be.INFO",
- rowset_partition_id_eq_0_num,
config::ignore_invalid_partition_id_rowset_num);
- exit(-1);
+ rowset_partition_id_eq_0_num,
config::ignore_invalid_partition_id_rowset_num));
}
// traverse rowset
diff --git a/be/src/olap/key_coder.h b/be/src/olap/key_coder.h
index 6885a0d96f2..549ac53656b 100644
--- a/be/src/olap/key_coder.h
+++ b/be/src/olap/key_coder.h
@@ -109,8 +109,8 @@ private:
case 16:
return BigEndian::FromHost128(val);
default:
- LOG(FATAL) << "Invalid type to big endian, type=" <<
int(field_type)
- << ", size=" << sizeof(UnsignedCppType);
+ throw Exception(Status::FatalError("Invalid type to big
endian, type={}, size={}",
+ int(field_type),
sizeof(UnsignedCppType)));
}
}
}
@@ -300,8 +300,7 @@ public:
}
static Status decode_ascending(Slice* encoded_key, size_t index_size,
uint8_t* cell_ptr) {
- LOG(FATAL) << "decode_ascending is not implemented";
- return Status::OK();
+ throw Exception(Status::FatalError("decode_ascending is not
implemented"));
}
};
@@ -320,8 +319,7 @@ public:
}
static Status decode_ascending(Slice* encoded_key, size_t index_size,
uint8_t* cell_ptr) {
- LOG(FATAL) << "decode_ascending is not implemented";
- return Status::OK();
+ throw Exception(Status::FatalError("decode_ascending is not
implemented"));
}
};
@@ -340,8 +338,7 @@ public:
}
static Status decode_ascending(Slice* encoded_key, size_t index_size,
uint8_t* cell_ptr) {
- LOG(FATAL) << "decode_ascending is not implemented";
- return Status::OK();
+ throw Exception(Status::FatalError("decode_ascending is not
implemented"));
}
};
diff --git a/be/src/olap/like_column_predicate.h
b/be/src/olap/like_column_predicate.h
index 31763d45f7e..e0d185c7bd3 100644
--- a/be/src/olap/like_column_predicate.h
+++ b/be/src/olap/like_column_predicate.h
@@ -128,8 +128,8 @@ private:
}
}
} else {
- LOG(FATAL) << "vectorized (not) like predicates should be dict
column";
- __builtin_unreachable();
+ throw Exception(Status::FatalError(
+ "vectorized (not) like predicates should be dict
column"));
}
} else {
if (column.is_column_dictionary()) {
@@ -153,8 +153,8 @@ private:
}
}
} else {
- LOG(FATAL) << "vectorized (not) like predicates should be dict
column";
- __builtin_unreachable();
+ throw Exception(Status::FatalError(
+ "vectorized (not) like predicates should be dict
column"));
}
}
}
diff --git a/be/src/olap/match_predicate.h b/be/src/olap/match_predicate.h
index ad202b7b242..3ff1775fd88 100644
--- a/be/src/olap/match_predicate.h
+++ b/be/src/olap/match_predicate.h
@@ -55,8 +55,7 @@ public:
//evaluate predicate on Bitmap
Status evaluate(BitmapIndexIterator* iterator, uint32_t num_rows,
roaring::Roaring* roaring) const override {
- LOG(FATAL) << "Not Implemented MatchPredicate::evaluate";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Not Implemented
MatchPredicate::evaluate"));
}
//evaluate predicate on inverted
diff --git a/be/src/olap/null_predicate.h b/be/src/olap/null_predicate.h
index 59480264b46..8e3fef1ff27 100644
--- a/be/src/olap/null_predicate.h
+++ b/be/src/olap/null_predicate.h
@@ -87,8 +87,8 @@ public:
if (_is_null) {
return bf->test_bytes(nullptr, 0);
} else {
- LOG(FATAL) << "Bloom filter is not supported by predicate type:
is_null=" << _is_null;
- return true;
+ throw Exception(Status::FatalError(
+ "Bloom filter is not supported by predicate type:
is_null="));
}
}
diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h
index 11249bafb1e..3b892e5d360 100644
--- a/be/src/olap/olap_common.h
+++ b/be/src/olap/olap_common.h
@@ -36,6 +36,7 @@
#include <utility>
#include "common/config.h"
+#include "common/exception.h"
#include "io/io_common.h"
#include "olap/olap_define.h"
#include "olap/rowset/rowset_fwd.h"
@@ -419,7 +420,8 @@ struct RowsetId {
LOG(WARNING) << "failed to init rowset id: " <<
rowset_id_str;
high = next_rowset_id().hi;
} else {
- LOG(FATAL) << "failed to init rowset id: " <<
rowset_id_str;
+ throw Exception(
+ Status::FatalError("failed to init rowset id: {}",
rowset_id_str));
}
}
init(1, high, 0, 0);
@@ -440,7 +442,7 @@ struct RowsetId {
void init(int64_t id_version, int64_t high, int64_t middle, int64_t low) {
version = id_version;
if (UNLIKELY(high >= MAX_ROWSET_ID)) {
- LOG(FATAL) << "inc rowsetid is too large:" << high;
+ throw Exception(Status::FatalError("inc rowsetid is too large:{}",
high));
}
hi = (id_version << 56) + (high & LOW_56_BITS);
mi = middle;
diff --git a/be/src/olap/page_cache.h b/be/src/olap/page_cache.h
index 32b6683e782..db1a6808345 100644
--- a/be/src/olap/page_cache.h
+++ b/be/src/olap/page_cache.h
@@ -176,11 +176,9 @@ private:
return _pk_index_page_cache.get();
}
default:
- LOG(FATAL) << "get error type page cache";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("get error type page cache"));
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
};
diff --git a/be/src/olap/rowset/beta_rowset_writer_v2.h
b/be/src/olap/rowset/beta_rowset_writer_v2.h
index 78ec4a7dce7..9040003a68d 100644
--- a/be/src/olap/rowset/beta_rowset_writer_v2.h
+++ b/be/src/olap/rowset/beta_rowset_writer_v2.h
@@ -99,8 +99,7 @@ public:
};
RowsetSharedPtr manual_build(const RowsetMetaSharedPtr& rowset_meta)
override {
- LOG(FATAL) << "not implemeted";
- return nullptr;
+ throw Exception(Status::FatalError("not implemeted"));
}
PUniqueId load_id() override { return _context.load_id; }
diff --git a/be/src/olap/rowset/rowset_writer.h
b/be/src/olap/rowset/rowset_writer.h
index f84ff964ea3..0a0d36ea04a 100644
--- a/be/src/olap/rowset/rowset_writer.h
+++ b/be/src/olap/rowset/rowset_writer.h
@@ -170,7 +170,9 @@ public:
virtual int32_t allocate_segment_id() = 0;
- virtual void set_segment_start_id(int num_segment) { LOG(FATAL) << "not
supported!"; }
+ virtual void set_segment_start_id(int num_segment) {
+ throw Exception(Status::FatalError("not supported!"));
+ }
virtual int64_t delete_bitmap_ns() { return 0; }
diff --git a/be/src/olap/rowset/segment_v2/hierarchical_data_reader.cpp
b/be/src/olap/rowset/segment_v2/hierarchical_data_reader.cpp
index db6bac6b8b4..fe7167e9444 100644
--- a/be/src/olap/rowset/segment_v2/hierarchical_data_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/hierarchical_data_reader.cpp
@@ -80,8 +80,7 @@ Status HierarchicalDataReader::init(const
ColumnIteratorOptions& opts) {
}
Status HierarchicalDataReader::seek_to_first() {
- LOG(FATAL) << "Not implemented";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Not implemented"));
}
Status HierarchicalDataReader::seek_to_ordinal(ordinal_t ord) {
@@ -159,8 +158,7 @@ Status ExtractReader::init(const ColumnIteratorOptions&
opts) {
}
Status ExtractReader::seek_to_first() {
- LOG(FATAL) << "Not implemented";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Not implemented"));
}
Status ExtractReader::seek_to_ordinal(ordinal_t ord) {
diff --git a/be/src/olap/storage_policy.cpp b/be/src/olap/storage_policy.cpp
index 837e9bed178..3b4a1f1a185 100644
--- a/be/src/olap/storage_policy.cpp
+++ b/be/src/olap/storage_policy.cpp
@@ -141,8 +141,10 @@ std::vector<std::pair<std::string, int64_t>>
get_storage_resource_ids() {
namespace {
[[noreturn]] void exit_at_unknown_path_version(std::string_view resource_id,
int64_t path_version) {
- LOG(FATAL) << "unknown path version, please upgrade BE or drop this
storage vault. resource_id="
- << resource_id << " path_version=" << path_version;
+ throw Exception(
+ Status::FatalError("unknown path version, please upgrade BE or
drop this storage "
+ "vault. resource_id={} path_version={}",
+ resource_id, path_version));
}
} // namespace
diff --git a/be/src/olap/tablet_reader.cpp b/be/src/olap/tablet_reader.cpp
index a83e0bfdbf4..17cab2a3c0c 100644
--- a/be/src/olap/tablet_reader.cpp
+++ b/be/src/olap/tablet_reader.cpp
@@ -61,7 +61,7 @@ using namespace ErrorCode;
void TabletReader::ReaderParams::check_validation() const {
if (UNLIKELY(version.first == -1 && is_segcompaction == false)) {
- LOG(FATAL) << "version is not set. tablet=" << tablet->tablet_id();
+ throw Exception(Status::FatalError("version is not set. tablet={}",
tablet->tablet_id()));
}
}
diff --git a/be/src/pipeline/dependency.h b/be/src/pipeline/dependency.h
index f1cfe2b0297..ecbd49a5647 100644
--- a/be/src/pipeline/dependency.h
+++ b/be/src/pipeline/dependency.h
@@ -723,8 +723,7 @@ inline std::string get_exchange_type_name(ExchangeType idx)
{
case ExchangeType::LOCAL_MERGE_SORT:
return "LOCAL_MERGE_SORT";
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
struct DataDistribution {
diff --git a/be/src/pipeline/exec/exchange_sink_buffer.cpp
b/be/src/pipeline/exec/exchange_sink_buffer.cpp
index e3f895444d4..800ef615073 100644
--- a/be/src/pipeline/exec/exchange_sink_buffer.cpp
+++ b/be/src/pipeline/exec/exchange_sink_buffer.cpp
@@ -422,8 +422,7 @@ void ExchangeSinkBuffer::_ended(InstanceLoId id) {
}
LOG(INFO) << ss.str();
- LOG(FATAL) << "not find the instance id";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("not find the instance id"));
} else {
std::unique_lock<std::mutex>
lock(*_instance_to_package_queue_mutex[id]);
_running_sink_count[id]--;
diff --git a/be/src/pipeline/exec/exchange_sink_buffer.h
b/be/src/pipeline/exec/exchange_sink_buffer.h
index 458c7c3f66e..a381c5aff14 100644
--- a/be/src/pipeline/exec/exchange_sink_buffer.h
+++ b/be/src/pipeline/exec/exchange_sink_buffer.h
@@ -155,10 +155,9 @@ public:
start_rpc_time);
}
} catch (const std::exception& exp) {
- LOG(FATAL) << "brpc callback error: " << exp.what();
+ throw Exception(Status::FatalError("brpc callback error: {}",
exp.what()));
} catch (...) {
- LOG(FATAL) << "brpc callback error.";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("brpc callback error."));
}
}
int64_t start_rpc_time;
diff --git a/be/src/pipeline/exec/hashjoin_build_sink.cpp
b/be/src/pipeline/exec/hashjoin_build_sink.cpp
index 19e8493e596..47560875b51 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.cpp
+++ b/be/src/pipeline/exec/hashjoin_build_sink.cpp
@@ -303,9 +303,7 @@ Status
HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state,
[&](std::monostate& arg, auto join_op,
auto short_circuit_for_null_in_build_side,
auto with_other_conjuncts) -> Status {
- LOG(FATAL) << "FATAL: uninited hash table";
- __builtin_unreachable();
- return Status::OK();
+ throw Exception(Status::FatalError("FATAL: uninited
hash table"));
},
[&](auto&& arg, auto&& join_op, auto
short_circuit_for_null_in_build_side,
auto with_other_conjuncts) -> Status {
diff --git a/be/src/pipeline/exec/operator.cpp
b/be/src/pipeline/exec/operator.cpp
index f6664e147a3..bb254aae72b 100644
--- a/be/src/pipeline/exec/operator.cpp
+++ b/be/src/pipeline/exec/operator.cpp
@@ -414,8 +414,7 @@ std::shared_ptr<BasicSharedState>
DataSinkOperatorX<LocalStateType>::create_shar
return nullptr;
} else if constexpr (std::is_same_v<typename
LocalStateType::SharedStateType,
MultiCastSharedState>) {
- LOG(FATAL) << "should not reach here!";
- return nullptr;
+ throw Exception(Status::FatalError("should not reach here!"));
} else {
auto ss = LocalStateType::SharedStateType::create_shared();
ss->id = operator_id();
diff --git a/be/src/pipeline/exec/operator.h b/be/src/pipeline/exec/operator.h
index a2c8e110ced..df6e9c913b6 100644
--- a/be/src/pipeline/exec/operator.h
+++ b/be/src/pipeline/exec/operator.h
@@ -632,12 +632,10 @@ public:
_limit(-1) {}
virtual Status init(const TPlanNode& tnode, RuntimeState* state);
Status init(const TDataSink& tsink) override {
- LOG(FATAL) << "should not reach here!";
- return Status::OK();
+ throw Exception(Status::FatalError("should not reach here!"));
}
virtual Status init(ExchangeType type) {
- LOG(FATAL) << "should not reach here!";
- return Status::OK();
+ throw Exception(Status::FatalError("should not reach here!"));
}
[[noreturn]] virtual const std::vector<TRuntimeFilterDesc>&
runtime_filter_descs() {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, _op_name);
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index a371cdb947f..2d7554e7029 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -421,9 +421,9 @@ void
ExecEnv::init_file_cache_factory(std::vector<doris::CachePath>& cache_paths
std::unordered_set<std::string> cache_path_set;
Status rest =
doris::parse_conf_cache_paths(doris::config::file_cache_path, cache_paths);
if (!rest) {
- LOG(FATAL) << "parse config file cache path failed, path=" <<
doris::config::file_cache_path
- << ", reason=" << rest.msg();
- exit(-1);
+ throw Exception(
+ Status::FatalError("parse config file cache path failed,
path={}, reason={}",
+ doris::config::file_cache_path,
rest.msg()));
}
doris::Status cache_status;
@@ -437,8 +437,8 @@ void
ExecEnv::init_file_cache_factory(std::vector<doris::CachePath>& cache_paths
cache_path.path, cache_path.init_settings());
if (!cache_status.ok()) {
if (!doris::config::ignore_broken_disk) {
- LOG(FATAL) << "failed to init file cache, err: " <<
cache_status;
- exit(-1);
+ throw Exception(
+ Status::FatalError("failed to init file cache, err:
{}", cache_status));
}
LOG(WARNING) << "failed to init file cache, err: " << cache_status;
}
diff --git a/be/src/runtime/jsonb_value.h b/be/src/runtime/jsonb_value.h
index 65f4927759c..5f530db1ac8 100644
--- a/be/src/runtime/jsonb_value.h
+++ b/be/src/runtime/jsonb_value.h
@@ -61,58 +61,47 @@ struct JsonBinaryValue {
}
bool operator==(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
// !=
bool ne(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
// <=
bool le(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
// >=
bool ge(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
// <
bool lt(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
// >
bool gt(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
bool operator!=(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
bool operator<=(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
bool operator>=(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
bool operator<(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
bool operator>(const JsonBinaryValue& other) const {
- LOG(FATAL) << "comparing between JsonBinaryValue is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonBinaryValue
is not supported"));
}
Status from_json_string(const char* s, size_t len);
diff --git a/be/src/runtime/memory/cache_manager.h
b/be/src/runtime/memory/cache_manager.h
index a2a089b929d..1e89e957ba1 100644
--- a/be/src/runtime/memory/cache_manager.h
+++ b/be/src/runtime/memory/cache_manager.h
@@ -40,7 +40,8 @@ public:
#ifdef BE_TEST
_caches.erase(it);
#else
- LOG(FATAL) << "Repeat register cache " <<
CachePolicy::type_string(cache->type());
+ throw Exception(Status::FatalError("Repeat register cache {}",
+
CachePolicy::type_string(cache->type())));
#endif // BE_TEST
}
_caches.insert({cache->type(), cache});
diff --git a/be/src/runtime/memory/cache_policy.h
b/be/src/runtime/memory/cache_policy.h
index 8f077a4eb45..72e61fed2e0 100644
--- a/be/src/runtime/memory/cache_policy.h
+++ b/be/src/runtime/memory/cache_policy.h
@@ -99,10 +99,10 @@ public:
case CacheType::TABLET_COLUMN_OBJECT_POOL:
return "TabletColumnObjectPool";
default:
- LOG(FATAL) << "not match type of cache policy :" <<
static_cast<int>(type);
+ throw Exception(Status::FatalError("not match type of cache policy
:{}",
+ static_cast<int>(type)));
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
inline static std::unordered_map<std::string, CacheType> StringToType = {
diff --git a/be/src/runtime/memory/lru_cache_policy.h
b/be/src/runtime/memory/lru_cache_policy.h
index 3fdb43facd7..d4c282dab82 100644
--- a/be/src/runtime/memory/lru_cache_policy.h
+++ b/be/src/runtime/memory/lru_cache_policy.h
@@ -90,7 +90,8 @@ public:
case LRUCacheType::NUMBER:
return "number";
default:
- LOG(FATAL) << "not match type of lru cache:" <<
static_cast<int>(type);
+ throw Exception(
+ Status::FatalError("not match type of lru cache:{}",
static_cast<int>(type)));
}
}
diff --git a/be/src/runtime/memory/thread_mem_tracker_mgr.h
b/be/src/runtime/memory/thread_mem_tracker_mgr.h
index db3b32a6298..9dbf4399492 100644
--- a/be/src/runtime/memory/thread_mem_tracker_mgr.h
+++ b/be/src/runtime/memory/thread_mem_tracker_mgr.h
@@ -246,13 +246,13 @@ inline void ThreadMemTrackerMgr::consume(int64_t size,
int skip_large_memory_che
}
if (doris::config::crash_in_alloc_large_memory_bytes > 0 &&
size > doris::config::crash_in_alloc_large_memory_bytes) {
- LOG(FATAL) << fmt::format(
+ throw Exception(Status::FatalError(
"alloc large memory: {}, {}, crash generate core dumpsto
help analyze, "
"stacktrace:\n{}",
size,
is_attach_query() ? "in query or load: " +
print_id(_query_id)
: "not in query or load",
- get_stack_trace());
+ get_stack_trace()));
}
}
}
diff --git a/be/src/runtime/snapshot_loader.cpp
b/be/src/runtime/snapshot_loader.cpp
index 784904c78a3..b492a929fca 100644
--- a/be/src/runtime/snapshot_loader.cpp
+++ b/be/src/runtime/snapshot_loader.cpp
@@ -74,7 +74,7 @@ Status upload_with_checksum(io::RemoteFileSystem& fs,
std::string_view local_pat
RETURN_IF_ERROR(fs.upload(local_path, full_remote_path));
break;
default:
- LOG(FATAL) << "unknown fs type: " << static_cast<int>(fs.type());
+ throw Exception(Status::FatalError("unknown fs type: {}",
static_cast<int>(fs.type())));
}
return Status::OK();
}
@@ -807,8 +807,7 @@ Status SnapshotLoader::move(const std::string&
snapshot_path, TabletSharedPtr ta
}
} else {
- LOG(FATAL) << "only support overwrite now";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("only support overwrite now"));
}
// snapshot loader not need to change tablet uid
diff --git a/be/src/runtime/stream_load/stream_load_executor.cpp
b/be/src/runtime/stream_load/stream_load_executor.cpp
index ad4d22946f1..054de96a881 100644
--- a/be/src/runtime/stream_load/stream_load_executor.cpp
+++ b/be/src/runtime/stream_load/stream_load_executor.cpp
@@ -390,8 +390,7 @@ bool
StreamLoadExecutor::collect_load_stat(StreamLoadContext* ctx, TTxnCommitAtt
}
switch (ctx->load_type) {
case TLoadType::MINI_LOAD: {
- LOG(FATAL) << "mini load is not supported any more";
- break;
+ throw Exception(Status::FatalError("mini load is not supported any
more"));
}
case TLoadType::ROUTINE_LOAD: {
attach->loadType = TLoadType::ROUTINE_LOAD;
diff --git a/be/src/runtime/thread_context.h b/be/src/runtime/thread_context.h
index e0a44af69c1..9ba7949ec5a 100644
--- a/be/src/runtime/thread_context.h
+++ b/be/src/runtime/thread_context.h
@@ -354,8 +354,7 @@ public:
DCHECK(bthread_context != nullptr);
bthread_context->thread_local_handle_count--;
} else {
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
}
};
@@ -379,8 +378,8 @@ static ThreadContext* thread_context(bool allow_return_null
= false) {
return nullptr;
}
// It means that use thread_context() but this thread not attached a
query/load using SCOPED_ATTACH_TASK macro.
- LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
- __builtin_unreachable();
+ throw Exception(
+ Status::FatalError("__builtin_unreachable, {}",
doris::memory_orphan_check_msg));
}
// belong to one query object member, not be shared by multiple queries.
diff --git a/be/src/util/binary_cast.hpp b/be/src/util/binary_cast.hpp
index 8a91ab3a579..e7c62ad45ac 100644
--- a/be/src/util/binary_cast.hpp
+++ b/be/src/util/binary_cast.hpp
@@ -137,8 +137,7 @@ To binary_cast(From from) {
conv.decimal = from;
return conv.i128;
} else {
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
}
diff --git a/be/src/util/bit_util.h b/be/src/util/bit_util.h
index 504b0b27428..5ec5a8bf8e1 100644
--- a/be/src/util/bit_util.h
+++ b/be/src/util/bit_util.h
@@ -237,9 +237,7 @@ public:
} else if constexpr (std::is_same_v<T, uint8_t>) {
return value;
} else {
- __builtin_unreachable();
- LOG(FATAL) << "__builtin_unreachable";
- return value;
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
}
diff --git a/be/src/util/bitmap_value.h b/be/src/util/bitmap_value.h
index 2d15ac99611..528dbe40788 100644
--- a/be/src/util/bitmap_value.h
+++ b/be/src/util/bitmap_value.h
@@ -2519,8 +2519,7 @@ public:
}
break;
case BitmapValue::BitmapDataType::SET: {
- LOG(FATAL) << "BitmapValue with set do not support move";
- break;
+ throw Exception(Status::FatalError("BitmapValue with set do not
support move"));
}
default:
break;
diff --git a/be/src/util/block_compression.cpp
b/be/src/util/block_compression.cpp
index d1788b0948a..7a0aacd4252 100644
--- a/be/src/util/block_compression.cpp
+++ b/be/src/util/block_compression.cpp
@@ -233,7 +233,8 @@ public:
HadoopLz4BlockCompression() {
Status st = Decompressor::create_decompressor(CompressType::LZ4BLOCK,
&_decompressor);
if (!st.ok()) {
- LOG(FATAL) << "HadoopLz4BlockCompression construction failed.
status = " << st << "\n";
+ throw Exception(Status::FatalError(
+ "HadoopLz4BlockCompression construction failed. status =
{}", st));
}
}
diff --git a/be/src/util/easy_json.cc b/be/src/util/easy_json.cc
index 46c3a1867f7..fcb8021e383 100644
--- a/be/src/util/easy_json.cc
+++ b/be/src/util/easy_json.cc
@@ -27,6 +27,8 @@
#include <ostream>
#include <string>
#include <utility>
+
+#include "common/exception.h"
// IWYU pragma: no_include <rapidjson/encodings.h>
using rapidjson::SizeType;
@@ -200,8 +202,7 @@ EasyJson
EasyJson::PushBack(EasyJson::ComplexTypeInitializer val) {
} else if (val == kArray) {
push_val.SetArray();
} else {
- LOG(FATAL) << "Unknown initializer type";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Unknown initializer type"));
}
value_->PushBack(push_val, alloc_->allocator());
return EasyJson(&(*value_)[value_->Size() - 1], alloc_);
diff --git a/be/src/util/jsonb_utils.h b/be/src/util/jsonb_utils.h
index 7dba0dca3af..8ec842ef227 100644
--- a/be/src/util/jsonb_utils.h
+++ b/be/src/util/jsonb_utils.h
@@ -23,6 +23,7 @@
#include <sstream>
+#include "common/exception.h"
#include "jsonb_document.h"
#include "jsonb_stream.h"
#include "jsonb_writer.h"
@@ -42,7 +43,8 @@ public:
const std::string to_json_string(const char* data, size_t size) {
JsonbDocument* pdoc = doris::JsonbDocument::createDocument(data, size);
if (!pdoc) {
- LOG(FATAL) << "invalid json binary value: " <<
std::string_view(data, size);
+ throw Exception(Status::FatalError("invalid json binary value: {}",
+ std::string_view(data, size)));
}
return to_json_string(pdoc->getValue());
}
diff --git a/be/src/util/rle_encoding.h b/be/src/util/rle_encoding.h
index 206349b4728..5369ace9eed 100644
--- a/be/src/util/rle_encoding.h
+++ b/be/src/util/rle_encoding.h
@@ -283,7 +283,7 @@ void RleDecoder<T>::RewindOne() {
switch (rewind_state_) {
case CANT_REWIND:
- LOG(FATAL) << "Can't rewind more than once after each read!";
+ throw Exception(Status::FatalError("Can't rewind more than once after
each read!"));
break;
case REWIND_RUN:
++repeat_count_;
diff --git a/be/src/util/threadpool.cpp b/be/src/util/threadpool.cpp
index f5ea38515de..e9af13f556e 100644
--- a/be/src/util/threadpool.cpp
+++ b/be/src/util/threadpool.cpp
@@ -27,6 +27,7 @@
#include <thread>
#include <utility>
+#include "common/exception.h"
#include "common/logging.h"
#include "gutil/map-util.h"
#include "gutil/port.h"
@@ -194,7 +195,7 @@ void ThreadPoolToken::transition(State new_state) {
CHECK(false); // QUIESCED is a terminal state
break;
default:
- LOG(FATAL) << "Unknown token state: " << _state;
+ throw Exception(Status::FatalError("Unknown token state: {}", _state));
}
#endif
@@ -616,10 +617,10 @@ Status ThreadPool::create_thread() {
void ThreadPool::check_not_pool_thread_unlocked() {
Thread* current = Thread::current_thread();
if (ContainsKey(_threads, current)) {
- LOG(FATAL) << strings::Substitute(
- "Thread belonging to thread pool '$0' with "
- "name '$1' called pool function that would result in deadlock",
- _name, current->name());
+ throw Exception(
+ Status::FatalError("Thread belonging to thread pool {} with "
+ "name {} called pool function that would
result in deadlock",
+ _name, current->name()));
}
}
diff --git a/be/src/util/timezone_utils.cpp b/be/src/util/timezone_utils.cpp
index 6bb71ac4647..a26ad3703b7 100644
--- a/be/src/util/timezone_utils.cpp
+++ b/be/src/util/timezone_utils.cpp
@@ -35,6 +35,7 @@
#include <memory>
#include <string>
+#include "common/exception.h"
#include "common/logging.h"
#include "common/status.h"
@@ -83,8 +84,7 @@ void TimezoneUtils::load_timezones_to_cache() {
const auto root_path = fs::path {base_str};
if (!exists(root_path)) {
- LOG(FATAL) << "Cannot find system tzfile. Doris exiting!";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Cannot find system tzfile. Doris
exiting!"));
}
std::set<std::string> ignore_paths = {"posix", "right"}; // duplications.
ignore them.
diff --git a/be/src/vec/aggregate_functions/aggregate_function_map.h
b/be/src/vec/aggregate_functions/aggregate_function_map.h
index 17bc54f7499..7273390e7c5 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_map.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_map.h
@@ -40,10 +40,7 @@ struct AggregateFunctionMapAggData {
using KeyType = std::conditional_t<std::is_same_v<K, String>, StringRef,
K>;
using Map = phmap::flat_hash_map<StringRef, int64_t>;
- AggregateFunctionMapAggData() {
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
- }
+ AggregateFunctionMapAggData() { throw
Exception(Status::FatalError("__builtin_unreachable")); }
AggregateFunctionMapAggData(const DataTypes& argument_types) {
_key_type = remove_nullable(argument_types[0]);
diff --git
a/be/src/vec/aggregate_functions/aggregate_function_reader_first_last.h
b/be/src/vec/aggregate_functions/aggregate_function_reader_first_last.h
index 8efea2dc6fc..6f5d680d3eb 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_reader_first_last.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_reader_first_last.h
@@ -238,24 +238,17 @@ public:
void add_range_single_place(int64_t partition_start, int64_t
partition_end, int64_t frame_start,
int64_t frame_end, AggregateDataPtr place,
const IColumn** columns,
Arena*) const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "ReaderFunctionData do not support
add_range_single_place");
- __builtin_unreachable();
+ throw doris::Exception(
+ Status::FatalError("ReaderFunctionData do not support
add_range_single_place"));
}
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena*)
const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "ReaderFunctionData do not support merge");
- __builtin_unreachable();
+ throw doris::Exception(Status::FatalError("ReaderFunctionData do not
support merge"));
}
void serialize(ConstAggregateDataPtr place, BufferWritable& buf) const
override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "ReaderFunctionData do not support serialize");
- __builtin_unreachable();
+ throw doris::Exception(Status::FatalError("ReaderFunctionData do not
support serialize"));
}
void deserialize(AggregateDataPtr place, BufferReadable& buf, Arena*)
const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "ReaderFunctionData do not support
deserialize");
- __builtin_unreachable();
+ throw doris::Exception(Status::FatalError("ReaderFunctionData do not
support deserialize"));
}
private:
diff --git a/be/src/vec/aggregate_functions/aggregate_function_window.h
b/be/src/vec/aggregate_functions/aggregate_function_window.h
index 13fa8e74751..0cef4c82d3d 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_window.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_window.h
@@ -563,24 +563,19 @@ public:
void add(AggregateDataPtr place, const IColumn** columns, ssize_t row_num,
Arena*) const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "WindowFunctionLeadLagData do not support add");
- __builtin_unreachable();
+ throw doris::Exception(Status::FatalError("WindowFunctionLeadLagData
do not support add"));
}
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena*)
const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "WindowFunctionLeadLagData do not support
merge");
- __builtin_unreachable();
+ throw doris::Exception(
+ Status::FatalError("WindowFunctionLeadLagData do not support
merge"));
}
void serialize(ConstAggregateDataPtr place, BufferWritable& buf) const
override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "WindowFunctionLeadLagData do not support
serialize");
- __builtin_unreachable();
+ throw doris::Exception(
+ Status::FatalError("WindowFunctionLeadLagData do not support
serialize"));
}
void deserialize(AggregateDataPtr place, BufferReadable& buf, Arena*)
const override {
- throw doris::Exception(ErrorCode::INTERNAL_ERROR,
- "WindowFunctionLeadLagData do not support
deserialize");
- __builtin_unreachable();
+ throw doris::Exception(
+ Status::FatalError("WindowFunctionLeadLagData do not support
deserialize"));
}
private:
diff --git a/be/src/vec/columns/column_string.cpp
b/be/src/vec/columns/column_string.cpp
index cb83a29bbad..db0088e67c2 100644
--- a/be/src/vec/columns/column_string.cpp
+++ b/be/src/vec/columns/column_string.cpp
@@ -40,16 +40,16 @@ template <typename T>
void ColumnStr<T>::sanity_check() const {
auto count = offsets.size();
if (chars.size() != offsets[count - 1]) {
- LOG(FATAL) << "row count: " << count << ", chars.size(): " <<
chars.size() << ", offset["
- << count - 1 << "]: " << offsets[count - 1];
+ throw Exception(Status::FatalError("row count: {}, chars.size(): {},
offset[{}]: ", count,
+ chars.size(), count - 1,
offsets[count - 1]));
}
if (offsets[-1] != 0) {
- LOG(FATAL) << "wrong offsets[-1]: " << offsets[-1];
+ throw Exception(Status::FatalError("wrong offsets[-1]: {}",
offsets[-1]));
}
for (size_t i = 0; i < count; ++i) {
if (offsets[i] < offsets[i - 1]) {
- LOG(FATAL) << "row count: " << count << ", offsets[" << i << "]: "
<< offsets[i]
- << ", offsets[" << i - 1 << "]: " << offsets[i - 1];
+ throw Exception(Status::FatalError("row count: {}, offsets[{}]:
{}, offsets[{}]: {}",
+ count, i, offsets[i], i - 1,
offsets[i - 1]));
}
}
}
diff --git a/be/src/vec/common/assert_cast.h b/be/src/vec/common/assert_cast.h
index 02dce99e967..1905983a58c 100644
--- a/be/src/vec/common/assert_cast.h
+++ b/be/src/vec/common/assert_cast.h
@@ -23,6 +23,7 @@
#include <type_traits>
#include <typeinfo>
+#include "common/exception.h"
#include "common/logging.h"
#include "vec/common/demangle.h"
@@ -45,35 +46,33 @@ PURE To assert_cast(From&& from) {
if (auto ptr = dynamic_cast<To>(from); ptr != nullptr) {
return ptr;
}
- LOG(FATAL) << fmt::format("Bad cast from type:{}* to {}",
- demangle(typeid(*from).name()),
- demangle(typeid(To).name()));
+ throw doris::Exception(doris::Status::FatalError("Bad cast
from type:{}* to {}",
+
demangle(typeid(*from).name()),
+
demangle(typeid(To).name())));
}
} else {
if (typeid(from) == typeid(To)) {
return static_cast<To>(from);
}
}
- LOG(FATAL) << fmt::format("Bad cast from type:{} to {}",
demangle(typeid(from).name()),
- demangle(typeid(To).name()));
- __builtin_unreachable();
+ throw doris::Exception(doris::Status::FatalError("Bad cast from
type:{} to {}",
+
demangle(typeid(from).name()),
+
demangle(typeid(To).name())));
};
#ifndef NDEBUG
try {
return perform_cast(std::forward<From>(from));
} catch (const std::exception& e) {
- LOG(FATAL) << "assert cast err:" << e.what();
+ throw doris::Exception(doris::Status::FatalError("assert cast err:{}",
e.what()));
}
- __builtin_unreachable();
#else
if constexpr (check == TypeCheckOnRelease::ENABLE) {
try {
return perform_cast(std::forward<From>(from));
} catch (const std::exception& e) {
- LOG(FATAL) << "assert cast err:" << e.what();
+ throw doris::Exception(doris::Status::FatalError("assert cast
err:{}", e.what()));
}
- __builtin_unreachable();
} else {
return static_cast<To>(from);
}
diff --git a/be/src/vec/common/hash_table/string_hash_table.h
b/be/src/vec/common/hash_table/string_hash_table.h
index 74be1e85e1e..892598a8326 100644
--- a/be/src/vec/common/hash_table/string_hash_table.h
+++ b/be/src/vec/common/hash_table/string_hash_table.h
@@ -327,8 +327,7 @@ protected:
return iterator5 == rhs.iterator5;
}
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw
doris::Exception(doris::Status::FatalError("__builtin_unreachable"));
}
bool operator!=(const iterator_base& rhs) const { return !(*this ==
rhs); }
diff --git a/be/src/vec/common/schema_util.cpp
b/be/src/vec/common/schema_util.cpp
index fd50af3e1fc..2b1c71c643d 100644
--- a/be/src/vec/common/schema_util.cpp
+++ b/be/src/vec/common/schema_util.cpp
@@ -133,7 +133,7 @@ size_t get_size_of_interger(TypeIndex type) {
case TypeIndex::UInt128:
return sizeof(uint128_t);
default:
- LOG(FATAL) << "Unknown integer type: " << getTypeName(type);
+ throw Exception(Status::FatalError("Unknown integer type: {}",
getTypeName(type)));
return 0;
}
}
@@ -231,8 +231,7 @@ void get_column_by_type(const vectorized::DataTypePtr&
data_type, const std::str
return;
}
// TODO handle more types like struct/date/datetime/decimal...
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
TabletColumn get_column_by_type(const vectorized::DataTypePtr& data_type,
const std::string& name,
diff --git a/be/src/vec/core/block.cpp b/be/src/vec/core/block.cpp
index 4dc553b1a57..951c2661faf 100644
--- a/be/src/vec/core/block.cpp
+++ b/be/src/vec/core/block.cpp
@@ -644,10 +644,10 @@ Block Block::clone_with_columns(const Columns& columns)
const {
size_t num_columns = data.size();
if (num_columns != columns.size()) {
- LOG(FATAL) << fmt::format(
+ throw Exception(Status::FatalError(
"Cannot clone block with columns because block has {} columns,
but {} columns "
"given.",
- num_columns, columns.size());
+ num_columns, columns.size()));
}
for (size_t i = 0; i < num_columns; ++i) {
diff --git a/be/src/vec/core/decimal_comparison.h
b/be/src/vec/core/decimal_comparison.h
index 9e9d9ad399a..4503a264c28 100644
--- a/be/src/vec/core/decimal_comparison.h
+++ b/be/src/vec/core/decimal_comparison.h
@@ -82,8 +82,9 @@ public:
DecimalComparison(Block& block, uint32_t result, const
ColumnWithTypeAndName& col_left,
const ColumnWithTypeAndName& col_right) {
if (!apply(block, result, col_left, col_right)) {
- LOG(FATAL) << fmt::format("Wrong decimal comparison with {} and
{}",
- col_left.type->get_name(),
col_right.type->get_name());
+ throw Exception(Status::FatalError("Wrong decimal comparison with
{} and {}",
+ col_left.type->get_name(),
+ col_right.type->get_name()));
}
}
@@ -106,8 +107,7 @@ public:
static bool compare(A a, B b, UInt32 scale_a, UInt32 scale_b) {
static const UInt32 max_scale = max_decimal_precision<Decimal256>();
if (scale_a > max_scale || scale_b > max_scale) {
- LOG(FATAL) << "Bad scale of decimal field";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Bad scale of decimal field"));
}
Shift shift;
@@ -213,8 +213,7 @@ private:
if (const ColVecB* c1_vec =
check_and_get_column<ColVecB>(c1.get()))
constant_vector<scale_left, scale_right>(a,
c1_vec->get_data(), vec_res, scale);
else {
- LOG(FATAL) << "Wrong column in Decimal comparison";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Wrong column in
Decimal comparison"));
}
} else if (c1_is_const) {
const ColumnConst* c1_const =
check_and_get_column_const<ColVecB>(c1.get());
@@ -222,8 +221,7 @@ private:
if (const ColVecA* c0_vec =
check_and_get_column<ColVecA>(c0.get()))
vector_constant<scale_left,
scale_right>(c0_vec->get_data(), b, vec_res, scale);
else {
- LOG(FATAL) << "Wrong column in Decimal comparison";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Wrong column in
Decimal comparison"));
}
} else {
if (const ColVecA* c0_vec =
check_and_get_column<ColVecA>(c0.get())) {
@@ -231,12 +229,10 @@ private:
vector_vector<scale_left,
scale_right>(c0_vec->get_data(),
c1_vec->get_data(), vec_res, scale);
else {
- LOG(FATAL) << "Wrong column in Decimal comparison";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Wrong column in
Decimal comparison"));
}
} else {
- LOG(FATAL) << "Wrong column in Decimal comparison";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Wrong column in
Decimal comparison"));
}
}
return c_res;
@@ -262,8 +258,7 @@ private:
if constexpr (scale_right) overflow |= common::mul_overflow(y,
scale, y);
if (overflow) {
- LOG(FATAL) << "Can't compare";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Can't compare"));
}
} else {
if constexpr (scale_left) x *= scale;
diff --git a/be/src/vec/core/field.h b/be/src/vec/core/field.h
index 341f65e075e..1176840738a 100644
--- a/be/src/vec/core/field.h
+++ b/be/src/vec/core/field.h
@@ -38,6 +38,7 @@
#include <vector>
#include "common/compiler_util.h" // IWYU pragma: keep
+#include "common/exception.h"
#include "olap/hll.h"
#include "util/bitmap_value.h"
#include "util/quantile_state.h"
@@ -168,7 +169,7 @@ public:
JsonbField(const char* ptr, size_t len) : size(len) {
data = new char[size];
if (!data) {
- LOG(FATAL) << "new data buffer failed, size: " << size;
+ throw Exception(Status::FatalError("new data buffer failed, size:
{}", size));
}
memcpy(data, ptr, size);
}
@@ -176,7 +177,7 @@ public:
JsonbField(const JsonbField& x) : size(x.size) {
data = new char[size];
if (!data) {
- LOG(FATAL) << "new data buffer failed, size: " << size;
+ throw Exception(Status::FatalError("new data buffer failed, size:
{}", size));
}
memcpy(data, x.data, size);
}
@@ -189,7 +190,7 @@ public:
JsonbField& operator=(const JsonbField& x) {
data = new char[size];
if (!data) {
- LOG(FATAL) << "new data buffer failed, size: " << size;
+ throw Exception(Status::FatalError("new data buffer failed, size:
{}", size));
}
memcpy(data, x.data, size);
return *this;
@@ -216,38 +217,30 @@ public:
size_t get_size() const { return size; }
bool operator<(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
bool operator<=(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
bool operator==(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
bool operator>(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
bool operator>=(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
bool operator!=(const JsonbField& r) const {
- LOG(FATAL) << "comparing between JsonbField is not supported";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("comparing between JsonbField is
not supported"));
}
const JsonbField& operator+=(const JsonbField& r) {
- LOG(FATAL) << "Not support plus opration on JsonbField";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Not support plus opration on
JsonbField"));
}
const JsonbField& operator-=(const JsonbField& r) {
- LOG(FATAL) << "Not support minus opration on JsonbField";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Not support minus opration on
JsonbField"));
}
private:
@@ -305,8 +298,7 @@ public:
const DecimalField<T>& operator+=(const DecimalField<T>& r) {
if (scale != r.get_scale()) {
- LOG(FATAL) << "Add different decimal fields";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Add different decimal
fields"));
}
dec += r.get_value();
return *this;
@@ -314,8 +306,7 @@ public:
const DecimalField<T>& operator-=(const DecimalField<T>& r) {
if (scale != r.get_scale()) {
- LOG(FATAL) << "Sub different decimal fields";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Sub different decimal
fields"));
}
dec -= r.get_value();
return *this;
@@ -422,8 +413,8 @@ public:
case IPv6:
return "IPv6";
default:
- LOG(FATAL) << "type not supported, type=" <<
Types::to_string(which);
- break;
+ throw Exception(
+ Status::FatalError("type not supported, type={}",
Types::to_string(which)));
}
__builtin_unreachable();
}
@@ -558,8 +549,9 @@ public:
return which <=> rhs.which;
}
if (which != rhs.which) {
- LOG(FATAL) << "lhs type not equal with rhs, lhs=" <<
Types::to_string(which)
- << ", rhs=" << Types::to_string(rhs.which);
+ throw Exception(Status::FatalError("lhs type not equal with rhs,
lhs={}, rhs={}",
+ Types::to_string(which),
+ Types::to_string(rhs.which)));
}
switch (which) {
@@ -601,9 +593,9 @@ public:
case Types::Decimal256:
return get<Decimal256>() <=> rhs.get<Decimal256>();
default:
- LOG(FATAL) << "lhs type not equal with rhs, lhs=" <<
Types::to_string(which)
- << ", rhs=" << Types::to_string(rhs.which);
- break;
+ throw Exception(Status::FatalError("lhs type not equal with rhs,
lhs={}, rhs={}",
+ Types::to_string(which),
+ Types::to_string(rhs.which)));
}
}
@@ -675,8 +667,8 @@ public:
f(field.template get<QuantileState>());
return;
default:
- LOG(FATAL) << "type not supported, type=" <<
Types::to_string(field.which);
- break;
+ throw Exception(Status::FatalError("type not supported, type={}",
+ Types::to_string(field.which)));
}
}
diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h
index c817c6ab273..223dc13c818 100644
--- a/be/src/vec/core/types.h
+++ b/be/src/vec/core/types.h
@@ -942,8 +942,7 @@ inline const char* getTypeName(TypeIndex idx) {
return "Time";
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
// NOLINTEND(readability-function-size)
} // namespace vectorized
diff --git a/be/src/vec/data_types/data_type_number_base.cpp
b/be/src/vec/data_types/data_type_number_base.cpp
index 1afed3d7d1a..55330bd2797 100644
--- a/be/src/vec/data_types/data_type_number_base.cpp
+++ b/be/src/vec/data_types/data_type_number_base.cpp
@@ -158,8 +158,7 @@ Field DataTypeNumberBase<T>::get_field(const TExprNode&
node) const {
if constexpr (std::is_same_v<TypeId<T>, TypeId<Float64>>) {
return Float64(node.float_literal.value);
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
template <typename T>
diff --git a/be/src/vec/data_types/data_type_number_base.h
b/be/src/vec/data_types/data_type_number_base.h
index a73bd995189..c560fdd01ad 100644
--- a/be/src/vec/data_types/data_type_number_base.h
+++ b/be/src/vec/data_types/data_type_number_base.h
@@ -125,8 +125,7 @@ public:
if constexpr (std::is_same_v<TypeId<T>, TypeId<Float64>>) {
return doris::FieldType::OLAP_FIELD_TYPE_DOUBLE;
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
Field get_default() const override;
diff --git a/be/src/vec/data_types/serde/data_type_serde.h
b/be/src/vec/data_types/serde/data_type_serde.h
index 1a089bb73fe..122a700cf9b 100644
--- a/be/src/vec/data_types/serde/data_type_serde.h
+++ b/be/src/vec/data_types/serde/data_type_serde.h
@@ -395,8 +395,9 @@ inline static NullMap revert_null_map(const NullMap*
null_bytemap, size_t start,
inline void checkArrowStatus(const arrow::Status& status, const std::string&
column,
const std::string& format_name) {
if (!status.ok()) {
- LOG(FATAL) << "arrow serde with arrow: " << format_name << " with
column : " << column
- << " with error msg: " << status.ToString();
+ throw Exception(
+ Status::FatalError("arrow serde with arrow: {} with column :
{} with error msg: {}",
+ format_name, column, status.ToString()));
}
}
diff --git a/be/src/vec/exec/format/parquet/bool_rle_decoder.cpp
b/be/src/vec/exec/format/parquet/bool_rle_decoder.cpp
index 17ce68e604e..3f46a9c0073 100644
--- a/be/src/vec/exec/format/parquet/bool_rle_decoder.cpp
+++ b/be/src/vec/exec/format/parquet/bool_rle_decoder.cpp
@@ -36,15 +36,16 @@ void BoolRLEDecoder::set_data(Slice* slice) {
_offset = 0;
_current_value_idx = 0;
if (_num_bytes < 4) {
- LOG(FATAL) << "Received invalid length : " +
std::to_string(_num_bytes) +
- " (corrupt data page?)";
+ throw Exception(Status::FatalError("Received invalid length : {}
(corrupt data page?)",
+ std::to_string(_num_bytes)));
}
// Load the first 4 bytes in little-endian, which indicates the length
const uint8_t* data = reinterpret_cast<const uint8_t*>(_data->data);
uint32_t num_bytes = decode_fixed32_le(data);
if (num_bytes > static_cast<uint32_t>(_num_bytes - 4)) {
- LOG(FATAL) << ("Received invalid number of bytes : " +
std::to_string(num_bytes) +
- " (corrupt data page?)");
+ throw Exception(
+ Status::FatalError("Received invalid number of bytes : {}
(corrupt data page?)",
+ std::to_string(_num_bytes)));
}
_num_bytes = num_bytes;
auto decoder_data = data + 4;
diff --git a/be/src/vec/exec/format/parquet/decoder.h
b/be/src/vec/exec/format/parquet/decoder.h
index 1654878af80..06e131b5b56 100644
--- a/be/src/vec/exec/format/parquet/decoder.h
+++ b/be/src/vec/exec/format/parquet/decoder.h
@@ -79,8 +79,8 @@ public:
}
virtual MutableColumnPtr convert_dict_column_to_string_column(const
ColumnInt32* dict_column) {
- LOG(FATAL) << "Method convert_dict_column_to_string_column is not
supported";
- __builtin_unreachable();
+ throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
+ "Method convert_dict_column_to_string_column is
not supported");
}
protected:
diff --git a/be/src/vec/exec/format/parquet/delta_bit_pack_decoder.h
b/be/src/vec/exec/format/parquet/delta_bit_pack_decoder.h
index 9497aa1cb1c..dbe90acc985 100644
--- a/be/src/vec/exec/format/parquet/delta_bit_pack_decoder.h
+++ b/be/src/vec/exec/format/parquet/delta_bit_pack_decoder.h
@@ -177,7 +177,8 @@ public:
_bit_reader.reset(new BitReader((const uint8_t*)slice->data,
slice->size));
Status st = _init_header();
if (!st.ok()) {
- LOG(FATAL) << "Fail to init delta encoding header for " <<
st.to_string();
+ throw Exception(Status::FatalError("Fail to init delta encoding
header for {}",
+ st.to_string()));
}
_data = slice;
_offset = 0;
@@ -189,7 +190,8 @@ public:
_bit_reader = std::move(bit_reader);
Status st = _init_header();
if (!st.ok()) {
- LOG(FATAL) << "Fail to init delta encoding header for " <<
st.to_string();
+ throw Exception(Status::FatalError("Fail to init delta encoding
header for {}",
+ st.to_string()));
}
}
@@ -345,7 +347,7 @@ public:
int ret;
Status st = _prefix_len_decoder.decode(_buffered_prefix_length.data(),
num_prefix, &ret);
if (!st.ok()) {
- LOG(FATAL) << "Fail to decode delta prefix, status: " << st;
+ throw Exception(Status::FatalError("Fail to decode delta prefix,
status: {}", st));
}
DCHECK_EQ(ret, num_prefix);
_prefix_len_offset = 0;
@@ -527,7 +529,7 @@ void DeltaLengthByteArrayDecoder::_decode_lengths() {
int ret;
Status st = _len_decoder.decode(_buffered_length.data(), num_length, &ret);
if (!st.ok()) {
- LOG(FATAL) << "Fail to decode delta length, status: " << st;
+ throw Exception(Status::FatalError("Fail to decode delta length,
status: {}", st));
}
DCHECK_EQ(ret, num_length);
_length_idx = 0;
diff --git a/be/src/vec/exec/format/parquet/parquet_column_convert.h
b/be/src/vec/exec/format/parquet/parquet_column_convert.h
index cf6f8aa13fa..d35a69ff59c 100644
--- a/be/src/vec/exec/format/parquet/parquet_column_convert.h
+++ b/be/src/vec/exec/format/parquet/parquet_column_convert.h
@@ -423,8 +423,7 @@ public:
switch (_type_length) {
APPLY_FOR_DECIMALS()
default:
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
return Status::OK();
#undef APPLY_FOR_DECIMALS
@@ -456,8 +455,7 @@ public:
} else if constexpr (ScaleType == DecimalScaleParams::NO_SCALE) {
// do nothing
} else {
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
auto& v = reinterpret_cast<DecimalType&>(data[start_idx + i]);
v = (DecimalType)value;
@@ -501,8 +499,7 @@ class StringToDecimal : public PhysicalToLogicalConverter {
} else if constexpr (ScaleType ==
DecimalScaleParams::NO_SCALE) {
// do nothing
} else {
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw
Exception(Status::FatalError("__builtin_unreachable"));
}
}
auto& v = reinterpret_cast<DecimalType&>(data[start_idx + i]);
diff --git a/be/src/vec/exec/format/parquet/vparquet_column_reader.h
b/be/src/vec/exec/format/parquet/vparquet_column_reader.h
index 4c6e5b1eac9..a8062d2d9f9 100644
--- a/be/src/vec/exec/format/parquet/vparquet_column_reader.h
+++ b/be/src/vec/exec/format/parquet/vparquet_column_reader.h
@@ -129,8 +129,8 @@ public:
}
virtual MutableColumnPtr convert_dict_column_to_string_column(const
ColumnInt32* dict_column) {
- LOG(FATAL) << "Method convert_dict_column_to_string_column is not
supported";
- __builtin_unreachable();
+ throw Exception(
+ Status::FatalError("Method
convert_dict_column_to_string_column is not supported"));
}
static Status create(io::FileReaderSPtr file, FieldSchema* field,
diff --git a/be/src/vec/exec/jni_connector.cpp
b/be/src/vec/exec/jni_connector.cpp
index a87ccf987ac..11a58e81c98 100644
--- a/be/src/vec/exec/jni_connector.cpp
+++ b/be/src/vec/exec/jni_connector.cpp
@@ -185,8 +185,8 @@ Status JniConnector::close() {
jthrowable exc = (env)->ExceptionOccurred();
if (exc != nullptr) {
// Ensure successful resource release
- LOG(FATAL) << "Failed to release jni resource: "
- << JniUtil::GetJniExceptionMsg(env).to_string();
+ throw Exception(Status::FatalError("Failed to release jni
resource: {}",
+
JniUtil::GetJniExceptionMsg(env).to_string()));
}
}
return Status::OK();
diff --git a/be/src/vec/exec/scan/split_source_connector.h
b/be/src/vec/exec/scan/split_source_connector.h
index 8f38cd4f17a..abe59562578 100644
--- a/be/src/vec/exec/scan/split_source_connector.h
+++ b/be/src/vec/exec/scan/split_source_connector.h
@@ -117,7 +117,8 @@ public:
// for compatibility.
return
&_scan_ranges[0].scan_range.ext_scan_range.file_scan_range.params;
}
- LOG(FATAL) << "Unreachable, params is got by
file_scan_range_params_map";
+ throw Exception(
+ Status::FatalError("Unreachable, params is got by
file_scan_range_params_map"));
}
};
@@ -160,7 +161,8 @@ public:
int num_scan_ranges() override { return _num_splits; }
TFileScanRangeParams* get_params() override {
- LOG(FATAL) << "Unreachable, params is got by
file_scan_range_params_map";
+ throw Exception(
+ Status::FatalError("Unreachable, params is got by
file_scan_range_params_map"));
}
};
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 953fbaa9c38..91786337244 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -237,18 +237,18 @@ public:
// If this expr is a BloomPredicate, this method will return a
BloomFilterFunc
virtual std::shared_ptr<BloomFilterFuncBase> get_bloom_filter_func() const
{
- LOG(FATAL) << "Method 'get_bloom_filter_func()' is not supported in
expression: "
- << this->debug_string();
- return nullptr;
+ throw Exception(Status::FatalError(
+ "Method 'get_bloom_filter_func()' is not supported in
expression: {}",
+ this->debug_string()));
}
virtual std::shared_ptr<HybridSetBase> get_set_func() const { return
nullptr; }
// If this expr is a BitmapPredicate, this method will return a
BitmapFilterFunc
virtual std::shared_ptr<BitmapFilterFuncBase> get_bitmap_filter_func()
const {
- LOG(FATAL) << "Method 'get_bitmap_filter_func()' is not supported in
expression: "
- << this->debug_string();
- return nullptr;
+ throw Exception(Status::FatalError(
+ "Method 'get_bitmap_filter_func()' is not supported in
expression: {}",
+ this->debug_string()));
}
// fast_execute can direct copy expr filter result which build by apply
index in segment_iterator
diff --git a/be/src/vec/functions/array/function_array_apply.cpp
b/be/src/vec/functions/array/function_array_apply.cpp
index 75425389dd9..4161441080a 100644
--- a/be/src/vec/functions/array/function_array_apply.cpp
+++ b/be/src/vec/functions/array/function_array_apply.cpp
@@ -24,6 +24,7 @@
#include <string>
#include <utility>
+#include "common/exception.h"
#include "common/status.h"
#include "runtime/thread_context.h"
#include "vec/aggregate_functions/aggregate_function.h"
@@ -130,8 +131,7 @@ private:
if constexpr (op == ApplyOp::GE) {
return data >= comp;
}
- LOG(FATAL) << "__builtin_unreachable";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("__builtin_unreachable"));
}
// need exception safety
diff --git a/be/src/vec/functions/function_cast.h
b/be/src/vec/functions/function_cast.h
index 48619ff85f8..af9e9d19267 100644
--- a/be/src/vec/functions/function_cast.h
+++ b/be/src/vec/functions/function_cast.h
@@ -665,7 +665,14 @@ struct ConvertImplNumberToJsonb {
} else if constexpr (std::is_same_v<ColumnFloat64, ColumnType>) {
writer.writeDouble(data[i]);
} else {
- LOG(FATAL) << "unsupported type ";
+ static_assert(std::is_same_v<ColumnType, ColumnUInt8> ||
+ std::is_same_v<ColumnType, ColumnInt8> ||
+ std::is_same_v<ColumnType, ColumnInt16>
||
+ std::is_same_v<ColumnType, ColumnInt32>
||
+ std::is_same_v<ColumnType, ColumnInt64>
||
+ std::is_same_v<ColumnType, ColumnInt128>
||
+ std::is_same_v<ColumnType,
ColumnFloat64>,
+ "unsupported type");
__builtin_unreachable();
}
column_string->insert_data(writer.getOutput()->getBuffer(),
@@ -950,8 +957,7 @@ struct ConvertImplFromJsonb {
res[i] = 0;
}
} else {
- LOG(FATAL) << "unsupported type ";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("unsupported type"));
}
}
diff --git a/be/src/vec/json/simd_json_parser.h
b/be/src/vec/json/simd_json_parser.h
index 5189e93563c..79924a12a3a 100644
--- a/be/src/vec/json/simd_json_parser.h
+++ b/be/src/vec/json/simd_json_parser.h
@@ -208,8 +208,8 @@ public:
/// Optional: Allocates memory to parse JSON documents faster.
void reserve(size_t max_size) {
if (parser.allocate(max_size) != simdjson::error_code::SUCCESS) {
- LOG(FATAL) << "Couldn't allocate " + std::to_string(max_size) +
- " bytes when parsing JSON";
+ throw Exception(Status::FatalError("Couldn't allocate {} bytes
when parsing JSON",
+ std::to_string(max_size)));
}
}
diff --git a/be/src/vec/olap/olap_data_convertor.h
b/be/src/vec/olap/olap_data_convertor.h
index 3473d9d26b5..75aff7dfec3 100644
--- a/be/src/vec/olap/olap_data_convertor.h
+++ b/be/src/vec/olap/olap_data_convertor.h
@@ -455,7 +455,8 @@ private:
const void* get_data() const override { return _results.data(); };
const void* get_data_at(size_t offset) const override {
- LOG(FATAL) << "now not support get_data_at for
OlapColumnDataConvertorArray";
+ throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
+ "now not support get_data_at for
OlapColumnDataConvertorArray");
__builtin_unreachable();
};
Status convert_to_olap() override;
@@ -484,7 +485,8 @@ private:
Status convert_to_olap() override;
const void* get_data() const override { return _results.data(); };
const void* get_data_at(size_t offset) const override {
- LOG(FATAL) << "now not support get_data_at for
OlapColumnDataConvertorMap";
+ throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
+ "now not support get_data_at for
OlapColumnDataConvertorMap");
__builtin_unreachable();
};
diff --git a/be/src/vec/runtime/vdatetime_value.cpp
b/be/src/vec/runtime/vdatetime_value.cpp
index 86c50f0936f..026648319d4 100644
--- a/be/src/vec/runtime/vdatetime_value.cpp
+++ b/be/src/vec/runtime/vdatetime_value.cpp
@@ -3434,8 +3434,7 @@ void DateV2Value<T>::unchecked_set_time(uint8_t hour,
uint8_t minute, uint16_t s
date_v2_value_.second_ = second;
date_v2_value_.microsecond_ = microsecond;
} else {
- LOG(FATAL) << "Invalid operation 'set_time' for date!";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Invalid operation 'set_time' for
date!"));
}
}
@@ -3444,8 +3443,7 @@ void DateV2Value<T>::set_microsecond(uint64_t
microsecond) {
if constexpr (is_datetime) {
date_v2_value_.microsecond_ = microsecond;
} else {
- LOG(FATAL) << "Invalid operation 'set_microsecond' for date!";
- __builtin_unreachable();
+ throw Exception(Status::FatalError("Invalid operation
'set_microsecond' for date!"));
}
}
diff --git a/be/test/util/threadpool_test.cpp b/be/test/util/threadpool_test.cpp
index 3859639539d..d331bd0d2ac 100644
--- a/be/test/util/threadpool_test.cpp
+++ b/be/test/util/threadpool_test.cpp
@@ -42,6 +42,7 @@
#include "common/logging.h"
#include "common/status.h"
+#include "gtest/gtest.h"
#include "gtest/gtest_pred_impl.h"
#include "gutil/strings/substitute.h"
#include "util/barrier.h"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]