Skip to content

Commit

Permalink
[branch-2.0] Picks "[Fix](schema change) Fix can't do reorder column …
Browse files Browse the repository at this point in the history
…schema change for MOW table and duplicate key table apache#37067" (apache#37515)

## Proposed changes

picks apache#37067
  • Loading branch information
bobhan1 authored and weixingyu12 committed Jul 26, 2024
1 parent b1968d6 commit 36c7fa2
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 441 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ private boolean processModifyColumn(ModifyColumnClause alterClause, OlapTable ol
}
if (!modColumn.isKey()) {
if (olapTable.getEnableUniqueKeyMergeOnWrite()) {
modColumn.setAggregationType(AggregateType.NONE, false);
modColumn.setAggregationType(AggregateType.NONE, true);
} else {
modColumn.setAggregationType(AggregateType.REPLACE, true);
}
Expand Down Expand Up @@ -928,7 +928,7 @@ private boolean addColumnInternal(OlapTable olapTable, Column newColumn, ColumnP
}
if (!newColumn.isKey()) {
if (olapTable.getEnableUniqueKeyMergeOnWrite()) {
newColumn.setAggregationType(AggregateType.NONE, false);
newColumn.setAggregationType(AggregateType.NONE, true);
} else {
newColumn.setAggregationType(AggregateType.REPLACE, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ public void analyze(Analyzer analyzer) throws UserException, AnalysisException {

for (ColumnDef columnDef : columnDefs) {
Column col = columnDef.toColumn();
if (keysDesc != null && keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
if (keysDesc != null && (keysDesc.getKeysType() == KeysType.UNIQUE_KEYS
|| keysDesc.getKeysType() == KeysType.DUP_KEYS)) {
if (!col.isKey()) {
col.setAggregationTypeImplicit(true);
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !dup --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343} 10

-- !dup --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} 10 {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343}
2 {"f1": "E", "f2": "F", "f3": 30, "f4": 484.3234} 20 \N

-- !mor --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343} 10

-- !mor --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} 10 {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343}
2 {"f1": "E", "f2": "F", "f3": 30, "f4": 484.3234} 20 \N

-- !mow --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343} 10

-- !mow --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} 10 {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343}
2 {"f1": "E", "f2": "F", "f3": 30, "f4": 484.3234} 20 \N

This file was deleted.

Loading

0 comments on commit 36c7fa2

Please sign in to comment.