[Bug](row store) Fix column aggregate info lost when table is unique model (#21506)

This commit is contained in:
lihangyu
2023-07-06 12:06:22 +08:00
committed by GitHub
parent 9d2f879bd2
commit 013bfc6a06
3 changed files with 85 additions and 3 deletions

View File

@ -181,8 +181,9 @@ public class ColumnDef {
"sequence column hidden column", false);
}
public static ColumnDef newRowStoreColumnDef() {
return new ColumnDef(Column.ROW_STORE_COL, TypeDef.create(PrimitiveType.STRING), false, null, false, false,
public static ColumnDef newRowStoreColumnDef(AggregateType aggregateType) {
return new ColumnDef(Column.ROW_STORE_COL, TypeDef.create(PrimitiveType.STRING), false,
aggregateType, false, false,
new ColumnDef.DefaultValue(true, ""), "doris row store hidden column", false);
}

View File

@ -464,7 +464,18 @@ public class CreateTableStmt extends DdlStmt {
}
// add a hidden column as row store
if (properties != null && PropertyAnalyzer.analyzeStoreRowColumn(new HashMap<>(properties))) {
columnDefs.add(ColumnDef.newRowStoreColumnDef());
if (keysDesc != null && keysDesc.getKeysType() == KeysType.AGG_KEYS) {
throw new AnalysisException("Aggregate table can't support row column now");
}
if (keysDesc != null && keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
if (enableUniqueKeyMergeOnWrite) {
columnDefs.add(ColumnDef.newRowStoreColumnDef(AggregateType.NONE));
} else {
columnDefs.add(ColumnDef.newRowStoreColumnDef(AggregateType.REPLACE));
}
} else {
columnDefs.add(ColumnDef.newRowStoreColumnDef(null));
}
}
if (Config.enable_hidden_version_column_by_default && keysDesc != null
&& keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {