mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix metadata editing
This commit is contained in:
parent
62dde8c327
commit
f8fa36c6bd
@ -447,7 +447,10 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column
|
||||
if (metadata_diff.skip_indices_changed)
|
||||
{
|
||||
ParserIndexDeclaration parser;
|
||||
new_indices_ast = parseQuery(parser, metadata_diff.new_skip_indices, 0);
|
||||
if (metadata_diff.new_skip_indices.empty())
|
||||
new_indices_ast.reset();
|
||||
else
|
||||
new_indices_ast = parseQuery(parser, metadata_diff.new_skip_indices, 0);
|
||||
}
|
||||
|
||||
storage_modifier = [&](IAST & ast)
|
||||
@ -464,7 +467,10 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column
|
||||
|
||||
storage_ast.set(storage_ast.order_by, new_order_by_ast);
|
||||
|
||||
storage_ast.set(storage_ast.indexes, new_indices_ast);
|
||||
if (new_indices_ast)
|
||||
storage_ast.set(storage_ast.indexes, new_indices_ast);
|
||||
else
|
||||
storage_ast.indexes = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@ -3082,6 +3088,10 @@ void StorageReplicatedMergeTree::alter(const AlterCommands & params,
|
||||
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
||||
ASTPtr new_indexes_ast = data.skip_indexes_ast;
|
||||
params.apply(new_columns, new_order_by_ast, new_primary_key_ast, new_indexes_ast);
|
||||
if (new_indexes_ast && new_indexes_ast->children.empty())
|
||||
{
|
||||
new_indexes_ast.reset();
|
||||
}
|
||||
|
||||
String new_columns_str = new_columns.toString();
|
||||
if (new_columns_str != data.getColumns().toString())
|
||||
@ -3092,7 +3102,7 @@ void StorageReplicatedMergeTree::alter(const AlterCommands & params,
|
||||
new_metadata.sorting_key = serializeAST(*MergeTreeData::extractKeyExpressionList(new_order_by_ast));
|
||||
if (new_indexes_ast.get() != data.skip_indexes_ast.get())
|
||||
{
|
||||
if (new_indexes_ast && !new_indexes_ast->children.empty())
|
||||
if (new_indexes_ast)
|
||||
new_metadata.skip_indexes = serializeAST(*new_indexes_ast.get());
|
||||
else
|
||||
new_metadata.skip_indexes = {};
|
||||
|
@ -25,4 +25,4 @@ CREATE TABLE test.minmax_idx ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDE
|
||||
1 2
|
||||
CREATE TABLE test.minmax_idx2 ( u64 UInt64, i32 Int32) ENGINE = MergeTree() ORDER BY u64 SETTINGS index_granularity = 8192
|
||||
1 2
|
||||
1 2
|
||||
1 2
|
||||
|
Loading…
Reference in New Issue
Block a user