This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 021ed1d6905 [fix](map)fix upgrade behavior from 1.2 version #36635
(#36983)
021ed1d6905 is described below
commit 021ed1d6905a12488d44492159b87b149c8f42a8
Author: amory <[email protected]>
AuthorDate: Sun Jun 30 12:11:03 2024 +0800
[fix](map)fix upgrade behavior from 1.2 version #36635 (#36983)
---
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 24b755d70cd..f6f131f9ad9 100644
--- a/be/src/olap/rowset/segment_v2/column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/column_reader.cpp
@@ -144,6 +144,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 dee0d520d1f..e9315f7a220 100644
--- a/be/src/olap/rowset/segment_v2/column_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/column_writer.cpp
@@ -260,6 +260,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 290e5a6bc25..0900c6d8d40 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -550,7 +550,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;
@@ -615,7 +616,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]