From 993659cd0b820d8f8c46876d353fb48dce2a0a56 Mon Sep 17 00:00:00 2001 From: amory Date: Tue, 29 Aug 2023 14:55:35 +0800 Subject: [PATCH] [FIX](serde) fix handle serde error #23565 --- .../data_types/serde/data_type_array_serde.h | 6 ++-- .../data_types/serde/data_type_bitmap_serde.h | 12 +++---- .../serde/data_type_date64_serde.cpp | 3 +- .../serde/data_type_datetimev2_serde.h | 2 +- .../serde/data_type_decimal_serde.cpp | 6 ++-- .../serde/data_type_decimal_serde.h | 6 ++-- .../serde/data_type_fixedlengthobject_serde.h | 32 ++++++++----------- .../data_types/serde/data_type_hll_serde.h | 2 +- .../data_types/serde/data_type_map_serde.h | 6 ++-- .../data_types/serde/data_type_number_serde.h | 6 ++-- .../data_types/serde/data_type_object_serde.h | 32 ++++++++----------- .../serde/data_type_quantilestate_serde.h | 16 +++++----- .../data_types/serde/data_type_struct_serde.h | 15 ++++----- 13 files changed, 68 insertions(+), 76 deletions(-) diff --git a/be/src/vec/data_types/serde/data_type_array_serde.h b/be/src/vec/data_types/serde/data_type_array_serde.h index 222564de0e..46b9c851d3 100644 --- a/be/src/vec/data_types/serde/data_type_array_serde.h +++ b/be/src/vec/data_types/serde/data_type_array_serde.h @@ -52,12 +52,10 @@ public: const FormatOptions& options) const override; Status write_column_to_pb(const IColumn& column, PValues& result, int start, int end) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } Status read_column_from_pb(IColumn& column, const PValues& arg) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("read_column_from_pb with type " + column.get_name()); } void write_one_cell_to_jsonb(const IColumn& column, JsonbWriter& result, Arena* mem_pool, diff --git a/be/src/vec/data_types/serde/data_type_bitmap_serde.h b/be/src/vec/data_types/serde/data_type_bitmap_serde.h index 3a36aad612..8bf532b4dc 100644 --- a/be/src/vec/data_types/serde/data_type_bitmap_serde.h +++ b/be/src/vec/data_types/serde/data_type_bitmap_serde.h @@ -46,14 +46,14 @@ public: } Status deserialize_one_cell_from_text(IColumn& column, Slice& slice, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_one_cell_from_text with type " + + column.get_name()); } Status deserialize_column_from_text_vector(IColumn& column, std::vector& slices, int* num_deserialized, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_column_from_text_vector with type " + + column.get_name()); } Status write_column_to_pb(const IColumn& column, PValues& result, int start, @@ -68,12 +68,12 @@ public: arrow::ArrayBuilder* array_builder, int start, int end) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_column_to_arrow with type " + column.get_name()); } void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, diff --git a/be/src/vec/data_types/serde/data_type_date64_serde.cpp b/be/src/vec/data_types/serde/data_type_date64_serde.cpp index afabb2f71d..5c60e68895 100644 --- a/be/src/vec/data_types/serde/data_type_date64_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_date64_serde.cpp @@ -219,7 +219,8 @@ void DataTypeDate64SerDe::read_column_from_arrow(IColumn& column, const arrow::A const auto type = std::static_pointer_cast(arrow_array->type()); divisor = time_unit_divisor(type->unit()); if (divisor == 0L) { - LOG(FATAL) << "Invalid Time Type:" << type->name(); + throw doris::Exception(doris::ErrorCode::INVALID_ARGUMENT, + "Invalid Time Type: " + type->name()); } for (size_t value_i = start; value_i < end; ++value_i) { VecDateTimeValue v; diff --git a/be/src/vec/data_types/serde/data_type_datetimev2_serde.h b/be/src/vec/data_types/serde/data_type_datetimev2_serde.h index 645ba928ec..97d14078cd 100644 --- a/be/src/vec/data_types/serde/data_type_datetimev2_serde.h +++ b/be/src/vec/data_types/serde/data_type_datetimev2_serde.h @@ -64,7 +64,7 @@ public: void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.cpp b/be/src/vec/data_types/serde/data_type_decimal_serde.cpp index cc4ee16d94..95bf1a4b1b 100644 --- a/be/src/vec/data_types/serde/data_type_decimal_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_decimal_serde.cpp @@ -149,7 +149,8 @@ void DataTypeDecimalSerDe::write_column_to_arrow(const IColumn& column, const array_builder->type()->name()); } } else { - LOG(FATAL) << "Not support write " << column.get_name() << " to arrow"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "write_column_to_arrow with type " + column.get_name()); } } @@ -190,7 +191,8 @@ void DataTypeDecimalSerDe::read_column_from_arrow(IColumn& column, column_data.emplace_back(*reinterpret_cast(concrete_array->Value(value_i))); } } else { - LOG(FATAL) << "Not support read " << column.get_name() << " from arrow"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "read_column_from_arrow with type " + column.get_name()); } } diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.h b/be/src/vec/data_types/serde/data_type_decimal_serde.h index f6826d6b44..57cf98327a 100644 --- a/be/src/vec/data_types/serde/data_type_decimal_serde.h +++ b/be/src/vec/data_types/serde/data_type_decimal_serde.h @@ -172,7 +172,8 @@ void DataTypeDecimalSerDe::write_one_cell_to_jsonb(const IColumn& column, Jso Decimal64::NativeType val = *reinterpret_cast(data_ref.data); result.writeInt64(val); } else { - LOG(FATAL) << "unknown Column " << column.get_name() << " for writing to jsonb"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "write_one_cell_to_jsonb with type " + column.get_name()); } } @@ -189,7 +190,8 @@ void DataTypeDecimalSerDe::read_one_cell_from_jsonb(IColumn& column, } else if constexpr (std::is_same_v>) { col.insert_value(static_cast(arg)->val()); } else { - LOG(FATAL) << "unknown jsonb " << arg->typeName() << " for writing to column"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "read_one_cell_from_jsonb with type " + column.get_name()); } } } // namespace vectorized diff --git a/be/src/vec/data_types/serde/data_type_fixedlengthobject_serde.h b/be/src/vec/data_types/serde/data_type_fixedlengthobject_serde.h index aa357aeb80..46928bdb99 100644 --- a/be/src/vec/data_types/serde/data_type_fixedlengthobject_serde.h +++ b/be/src/vec/data_types/serde/data_type_fixedlengthobject_serde.h @@ -39,68 +39,64 @@ public: void serialize_one_cell_to_text(const IColumn& column, int row_num, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_one_cell_to_text with type " + column.get_name()); } void serialize_column_to_text(const IColumn& column, int start_idx, int end_idx, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_column_to_text with type " + column.get_name()); } Status deserialize_one_cell_from_text(IColumn& column, Slice& slice, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_one_cell_from_text with type " + + column.get_name()); } Status deserialize_column_from_text_vector(IColumn& column, std::vector& slices, int* num_deserialized, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_column_from_text_vector with type " + + column.get_name()); } Status write_column_to_pb(const IColumn& column, PValues& result, int start, int end) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } Status read_column_from_pb(IColumn& column, const PValues& arg) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("read_column_from_pb with type " + column.get_name()); }; void write_one_cell_to_jsonb(const IColumn& column, JsonbWriter& result, Arena* mem_pool, int32_t col_id, int row_num) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_one_cell_to_jsonb with type " + column.get_name()); } void read_one_cell_from_jsonb(IColumn& column, const JsonbValue* arg) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_one_cell_from_jsonb with type " + column.get_name()); } void write_column_to_arrow(const IColumn& column, const NullMap* null_map, arrow::ArrayBuilder* array_builder, int start, int end) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_column_to_arrow with type " + column.get_name()); } void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, int row_idx, bool col_const) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_mysql with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, int row_idx, bool col_const) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } }; } // namespace vectorized diff --git a/be/src/vec/data_types/serde/data_type_hll_serde.h b/be/src/vec/data_types/serde/data_type_hll_serde.h index 46f90fc20c..b7bae1302a 100644 --- a/be/src/vec/data_types/serde/data_type_hll_serde.h +++ b/be/src/vec/data_types/serde/data_type_hll_serde.h @@ -56,7 +56,7 @@ public: void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, diff --git a/be/src/vec/data_types/serde/data_type_map_serde.h b/be/src/vec/data_types/serde/data_type_map_serde.h index e90ba11f29..05c129114a 100644 --- a/be/src/vec/data_types/serde/data_type_map_serde.h +++ b/be/src/vec/data_types/serde/data_type_map_serde.h @@ -51,12 +51,10 @@ public: const FormatOptions& options) const override; Status write_column_to_pb(const IColumn& column, PValues& result, int start, int end) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } Status read_column_from_pb(IColumn& column, const PValues& arg) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("read_column_from_pb with type " + column.get_name()); } void write_one_cell_to_jsonb(const IColumn& column, JsonbWriter& result, Arena* mem_pool, int32_t col_id, int row_num) const override; diff --git a/be/src/vec/data_types/serde/data_type_number_serde.h b/be/src/vec/data_types/serde/data_type_number_serde.h index 1e27ef03d1..cfe84a4f8f 100644 --- a/be/src/vec/data_types/serde/data_type_number_serde.h +++ b/be/src/vec/data_types/serde/data_type_number_serde.h @@ -235,7 +235,8 @@ void DataTypeNumberSerDe::read_one_cell_from_jsonb(IColumn& column, } else if constexpr (std::is_same_v) { col.insert_value(static_cast(arg)->val()); } else { - LOG(FATAL) << "unknown jsonb type " << arg->typeName() << " for writing to column"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "read_one_cell_from_jsonb with type '{}'", arg->typeName()); } } template @@ -271,7 +272,8 @@ void DataTypeNumberSerDe::write_one_cell_to_jsonb(const IColumn& column, double val = *reinterpret_cast(data_ref.data); result.writeDouble(val); } else { - LOG(FATAL) << "unknown column type " << column.get_name() << " for writing to jsonb"; + throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, + "write_one_cell_to_jsonb with type " + column.get_name()); } } diff --git a/be/src/vec/data_types/serde/data_type_object_serde.h b/be/src/vec/data_types/serde/data_type_object_serde.h index 3dddc06113..dc42176779 100644 --- a/be/src/vec/data_types/serde/data_type_object_serde.h +++ b/be/src/vec/data_types/serde/data_type_object_serde.h @@ -39,68 +39,64 @@ public: void serialize_one_cell_to_text(const IColumn& column, int row_num, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_one_cell_to_text with type " + column.get_name()); } void serialize_column_to_text(const IColumn& column, int start_idx, int end_idx, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_column_to_text with type " + column.get_name()); } Status deserialize_one_cell_from_text(IColumn& column, Slice& slice, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_one_cell_from_text with type " + + column.get_name()); } Status deserialize_column_from_text_vector(IColumn& column, std::vector& slices, int* num_deserialized, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_column_from_text_vector with type " + + column.get_name()); } Status write_column_to_pb(const IColumn& column, PValues& result, int start, int end) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } Status read_column_from_pb(IColumn& column, const PValues& arg) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("read_column_from_pb with type " + column.get_name()); } void write_one_cell_to_jsonb(const IColumn& column, JsonbWriter& result, Arena* mem_pool, int32_t col_id, int row_num) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_one_cell_to_jsonb with type " + column.get_name()); } void read_one_cell_from_jsonb(IColumn& column, const JsonbValue* arg) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_one_cell_from_jsonb with type " + column.get_name()); } void write_column_to_arrow(const IColumn& column, const NullMap* null_map, arrow::ArrayBuilder* array_builder, int start, int end) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_column_to_arrow with type " + column.get_name()); } void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, int row_idx, bool col_const) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_mysql with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, int row_idx, bool col_const) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_mysql with type " + column.get_name()); } }; } // namespace vectorized diff --git a/be/src/vec/data_types/serde/data_type_quantilestate_serde.h b/be/src/vec/data_types/serde/data_type_quantilestate_serde.h index 4c9dae672b..e9fe7a8a5d 100644 --- a/be/src/vec/data_types/serde/data_type_quantilestate_serde.h +++ b/be/src/vec/data_types/serde/data_type_quantilestate_serde.h @@ -43,25 +43,25 @@ public: void serialize_one_cell_to_text(const IColumn& column, int row_num, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_one_cell_to_text with type " + column.get_name()); } void serialize_column_to_text(const IColumn& column, int start_idx, int end_idx, BufferWritable& bw, FormatOptions& options) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "serialize_column_to_text with type " + column.get_name()); } Status deserialize_one_cell_from_text(IColumn& column, Slice& slice, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_one_cell_from_text with type " + + column.get_name()); } Status deserialize_column_from_text_vector(IColumn& column, std::vector& slices, int* num_deserialized, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("deserialize_column_from_text_vector with type " + + column.get_name()); } Status write_column_to_pb(const IColumn& column, PValues& result, int start, @@ -76,12 +76,12 @@ public: arrow::ArrayBuilder* array_builder, int start, int end) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "write_column_to_arrow with type " + column.get_name()); } void read_column_from_arrow(IColumn& column, const arrow::Array* arrow_array, int start, int end, const cctz::time_zone& ctz) const override { throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + "read_column_from_arrow with type " + column.get_name()); } Status write_column_to_mysql(const IColumn& column, MysqlRowBuffer& row_buffer, diff --git a/be/src/vec/data_types/serde/data_type_struct_serde.h b/be/src/vec/data_types/serde/data_type_struct_serde.h index 33d14c7411..ec36e12ebb 100644 --- a/be/src/vec/data_types/serde/data_type_struct_serde.h +++ b/be/src/vec/data_types/serde/data_type_struct_serde.h @@ -53,25 +53,22 @@ public: Status deserialize_one_cell_from_text(IColumn& column, Slice& slice, const FormatOptions& options) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "deserialize_one_cell_from_text with type " + column.get_name()); + return Status::NotSupported("deserialize_one_cell_from_text with type " + + column.get_name()); } Status deserialize_column_from_text_vector(IColumn& column, std::vector& slices, int* num_deserialized, const FormatOptions& options) const override { - throw doris::Exception( - ErrorCode::NOT_IMPLEMENTED_ERROR, - "deserialize_column_from_text_vector with type " + column.get_name()); + return Status::NotSupported("deserialize_column_from_text_vector with type " + + column.get_name()); } Status write_column_to_pb(const IColumn& column, PValues& result, int start, int end) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "write_column_to_pb with type " + column.get_name()); + return Status::NotSupported("write_column_to_pb with type " + column.get_name()); } Status read_column_from_pb(IColumn& column, const PValues& arg) const override { - throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "read_column_from_pb with type " + column.get_name()); + return Status::NotSupported("read_column_from_pb with type " + column.get_name()); } void write_one_cell_to_jsonb(const IColumn& column, JsonbWriter& result, Arena* mem_pool, int32_t col_id, int row_num) const override;