Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](schema change) Fix can't do reorder column schema change for MOW table and duplicate key table #37067

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,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 @@ -1387,6 +1387,14 @@ private void createJob(String rawSql, long dbId, OlapTable olapTable, Map<Long,
if (!alterColumn.equals(originSchema.get(i))) {
needAlterColumns.add(alterColumn);
hasColumnChange = true;
} else {
Column oriColumn = originSchema.get(i);
if ((oriColumn.getGeneratedColumnInfo() != null
|| alterColumn.getGeneratedColumnInfo() != null)
&& !oriColumn.getGeneratedColumnInfo().getExprSql()
.equals(alterColumn.getGeneratedColumnInfo().getExprSql())) {
throw new DdlException("Not supporting alter table modify generated columns.");
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void validate(boolean isOlap, Set<String> keysSet, boolean isEnableMergeO
}

if (isOlap) {
if (!isKey && keysType.equals(KeysType.UNIQUE_KEYS)) {
if (!isKey && (keysType.equals(KeysType.UNIQUE_KEYS) || keysType.equals(KeysType.DUP_KEYS))) {
aggTypeImplicit = 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} {"a":1,"b":[1],"c":1.0}

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

-- !mor --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343} {"a":1,"b":[1],"c":1.0}

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

-- !mow --
1 {"f1": "A", "f2": "B", "f3": 10, "f4": 3.14} {"f1": "C", "f2": "D", "f3": 20, "f4": 8.343} {"a":1,"b":[1],"c":1.0}

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

Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ suite("alter_column_test_generated_column") {
sql "alter table alter_column_gen_col modify column c double as (a+b) after e;"
exception "Not supporting alter table modify generated columns."
}
test {
sql "alter table alter_column_gen_col modify column c int as (a+b) after e;"
exception "Not supporting alter table modify generated columns."
}

// reorder column
qt_reorder "alter table alter_column_gen_col order by(a,c,b,d,e);"
Expand Down

This file was deleted.

Loading
Loading