This is an automated email from the ASF dual-hosted git repository. dataroaring 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 c08d894534c [fix](schema-change) Fix schema-change from non-null to null (#37487) c08d894534c is described below commit c08d894534ce7bea1f15ec25881c476cfff10ddc Author: Lightman <31928846+lchangli...@users.noreply.github.com> AuthorDate: Tue Jul 9 13:43:49 2024 +0800 [fix](schema-change) Fix schema-change from non-null to null (#37487) https://github.com/apache/doris/pull/32913 --- be/src/olap/schema_change.cpp | 23 +++++++++++++++++----- .../org/apache/doris/alter/SchemaChangeJobV2.java | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp index 822946cbab2..9d2b3b94a48 100644 --- a/be/src/olap/schema_change.cpp +++ b/be/src/olap/schema_change.cpp @@ -349,7 +349,7 @@ Status BlockChanger::change_block(vectorized::Block* ref_block, assert_cast<vectorized::ColumnNullable*>(new_col->assume_mutable().get()); new_nullable_col->change_nested_column(ref_col); - new_nullable_col->get_null_map_data().resize_fill(new_nullable_col->size()); + new_nullable_col->get_null_map_data().resize_fill(ref_col->size()); } else { // nullable to not nullable: // suppose column `c_phone` is originally varchar(16) NOT NULL, @@ -397,11 +397,24 @@ Status BlockChanger::_check_cast_valid(vectorized::ColumnPtr ref_column, return Status::DataQualityError("Null data is changed to not nullable"); } } else { - auto* new_null_map = + const auto& null_map_column = vectorized::check_and_get_column<vectorized::ColumnNullable>(new_column) - ->get_null_map_column() - .get_data() - .data(); + ->get_null_map_column(); + const auto& nested_column = + vectorized::check_and_get_column<vectorized::ColumnNullable>(new_column) + ->get_nested_column(); + const auto* new_null_map = null_map_column.get_data().data(); + + if (null_map_column.size() != new_column->size() || + nested_column.size() != new_column->size()) { + DCHECK(false) << "null_map_column_size=" << null_map_column.size() + << " new_column_size=" << new_column->size() + << " nested_column_size=" << nested_column.size(); + return Status::InternalError( + "null_map_column size is changed, null_map_column_size={}, " + "new_column_size={}", + null_map_column.size(), new_column->size()); + } bool is_changed = false; for (size_t i = 0; i < ref_column->size(); i++) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java index d59a6d6bf9e..242babdfd69 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java @@ -436,7 +436,7 @@ public class SchemaChangeJobV2 extends AlterJobV2 { if (indexColumnMap.containsKey(SchemaChangeHandler.SHADOW_NAME_PREFIX + column.getName())) { Column newColumn = indexColumnMap.get(SchemaChangeHandler.SHADOW_NAME_PREFIX + column.getName()); - if (newColumn.getType() != column.getType()) { + if (!newColumn.getType().equals(column.getType())) { try { SlotRef slot = new SlotRef(destSlotDesc); slot.setCol(column.getName()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org