[Improve](columns)replace fatal with exception #38035 (#38996)

This commit is contained in:
amory
2024-08-12 09:51:30 +08:00
committed by GitHub
parent 3da2d1c9d6
commit b38caed808
25 changed files with 328 additions and 259 deletions

View File

@ -50,8 +50,8 @@ ColumnMap::ColumnMap(MutableColumnPtr&& keys, MutableColumnPtr&& values, Mutable
const COffsets* offsets_concrete = typeid_cast<const COffsets*>(offsets_column.get());
if (!offsets_concrete) {
LOG(FATAL) << "offsets_column must be a ColumnUInt64";
__builtin_unreachable();
throw doris::Exception(doris::ErrorCode::INTERNAL_ERROR,
"offsets_column must be a ColumnUInt64.");
}
if (!offsets_concrete->empty() && keys_column && values_column) {
@ -59,12 +59,16 @@ ColumnMap::ColumnMap(MutableColumnPtr&& keys, MutableColumnPtr&& values, Mutable
/// This will also prevent possible overflow in offset.
if (keys_column->size() != last_offset) {
LOG(FATAL) << "offsets_column has data inconsistent with key_column "
<< keys_column->size() << " " << last_offset;
throw doris::Exception(
doris::ErrorCode::INTERNAL_ERROR,
"offsets_column size {} has data inconsistent with key_column {}", last_offset,
keys_column->size());
}
if (values_column->size() != last_offset) {
LOG(FATAL) << "offsets_column has data inconsistent with value_column "
<< values_column->size() << " " << last_offset;
throw doris::Exception(
doris::ErrorCode::INTERNAL_ERROR,
"offsets_column size {} has data inconsistent with value_column {}",
last_offset, values_column->size());
}
}
}
@ -106,9 +110,10 @@ Field ColumnMap::operator[](size_t n) const {
size_t element_size = size_at(n);
if (element_size > max_array_size_as_field) {
LOG(FATAL) << "element size " << start_offset
<< " is too large to be manipulated as single map field,"
<< "maximum size " << max_array_size_as_field;
throw doris::Exception(doris::ErrorCode::INTERNAL_ERROR,
"element size {} is too large to be manipulated as single map "
"field, maximum size {}",
element_size, max_array_size_as_field);
}
Array k(element_size), v(element_size);
@ -127,11 +132,13 @@ void ColumnMap::get(size_t n, Field& res) const {
}
StringRef ColumnMap::get_data_at(size_t n) const {
LOG(FATAL) << "Method get_data_at is not supported for " << get_name();
throw doris::Exception(doris::ErrorCode::INTERNAL_ERROR,
"Method get_data_at is not supported for {}", get_name());
}
void ColumnMap::insert_data(const char*, size_t) {
LOG(FATAL) << "Method insert_data is not supported for " << get_name();
throw doris::Exception(doris::ErrorCode::INTERNAL_ERROR,
"Method insert_data is not supported for {}", get_name());
}
void ColumnMap::insert(const Field& x) {