This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 08c13b0ec0b [fix](map) fix core dump when upgrading from 1.2.x to
2.0.x with map datatype column (#36635)
08c13b0ec0b is described below
commit 08c13b0ec0b08305b73042184a0dc25999e47ee9
Author: amory <[email protected]>
AuthorDate: Sun Jun 23 10:04:54 2024 +0800
[fix](map) fix core dump when upgrading from 1.2.x to 2.0.x with map
datatype column (#36635)
---
be/src/olap/rowset/segment_v2/column_reader.cpp | 1 +
be/src/olap/rowset/segment_v2/column_writer.cpp | 5 +++++
be/src/olap/tablet_schema.cpp | 6 ++++--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/column_reader.cpp
b/be/src/olap/rowset/segment_v2/column_reader.cpp
index 45ae123ae36..917f6563d80 100644
--- a/be/src/olap/rowset/segment_v2/column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/column_reader.cpp
@@ -137,6 +137,7 @@ Status ColumnReader::create(const ColumnReaderOptions&
opts, const ColumnMetaPB&
}
case FieldType::OLAP_FIELD_TYPE_MAP: {
// map reader now has 3 sub readers for key, value,
offsets(scalar), null(scala)
+ DCHECK(meta.children_columns_size() == 3 ||
meta.children_columns_size() == 4);
std::unique_ptr<ColumnReader> key_reader;
RETURN_IF_ERROR(ColumnReader::create(opts,
meta.children_columns(0),
meta.children_columns(0).num_rows(), file_reader,
diff --git a/be/src/olap/rowset/segment_v2/column_writer.cpp
b/be/src/olap/rowset/segment_v2/column_writer.cpp
index 19a0c4f3a84..6f618cc1ddc 100644
--- a/be/src/olap/rowset/segment_v2/column_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/column_writer.cpp
@@ -262,6 +262,11 @@ Status ColumnWriter::create(const ColumnWriterOptions&
opts, const TabletColumn*
}
case FieldType::OLAP_FIELD_TYPE_MAP: {
DCHECK(column->get_subtype_count() == 2);
+ if (column->get_subtype_count() < 2) {
+ return Status::InternalError(
+ "If you upgraded from version 1.2.*, please DROP the
MAP columns and then "
+ "ADD the MAP columns back.");
+ }
// create key & value writer
std::vector<std::unique_ptr<ColumnWriter>> inner_writer_list;
for (int i = 0; i < 2; ++i) {
diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp
index 6dd04782588..82c52195cff 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -441,7 +441,8 @@ void TabletColumn::init_from_pb(const ColumnPB& column) {
CHECK(column.children_columns_size() == 1) << "ARRAY type has more
than 1 children types.";
}
if (_type == FieldType::OLAP_FIELD_TYPE_MAP) {
- CHECK(column.children_columns_size() == 2) << "MAP type has more than
2 children types.";
+ DCHECK(column.children_columns_size() == 2) << "MAP type has more than
2 children types.";
+ LOG(WARNING) << "MAP type has more than 2 children types.";
}
for (size_t i = 0; i < column.children_columns_size(); i++) {
TabletColumn child_column;
@@ -481,7 +482,8 @@ void TabletColumn::to_schema_pb(ColumnPB* column) const {
CHECK(_sub_columns.size() == 1) << "ARRAY type has more than 1
children types.";
}
if (_type == FieldType::OLAP_FIELD_TYPE_MAP) {
- CHECK(_sub_columns.size() == 2) << "MAP type has more than 2 children
types.";
+ DCHECK(_sub_columns.size() == 2) << "MAP type has more than 2 children
types.";
+ LOG(WARNING) << "MAP type has more than 2 children types.";
}
for (size_t i = 0; i < _sub_columns.size(); i++) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]