mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
More tests on alter
This commit is contained in:
parent
d8aa5c7c49
commit
76c31a7764
@ -1178,16 +1178,18 @@ void MergeTreeData::createConvertExpression(const DataPartPtr & part, const Name
|
||||
|
||||
|
||||
/// Remove old indices
|
||||
std::set<String> new_indices_set;
|
||||
for (const auto & index_decl : new_indices)
|
||||
new_indices_set.emplace(index_decl->as<ASTIndexDeclaration &>().name);
|
||||
for (const auto & index_decl : old_indices)
|
||||
{
|
||||
const auto & index = index_decl->as<ASTIndexDeclaration &>();
|
||||
if (!new_indices_set.count(index.name))
|
||||
if (part) {
|
||||
std::set<String> new_indices_set;
|
||||
for (const auto & index_decl : new_indices)
|
||||
new_indices_set.emplace(index_decl->as<ASTIndexDeclaration &>().name);
|
||||
for (const auto & index_decl : old_indices)
|
||||
{
|
||||
out_rename_map["skp_idx_" + index.name + ".idx"] = "";
|
||||
out_rename_map["skp_idx_" + index.name + ".mrk"] = "";
|
||||
const auto & index = index_decl->as<ASTIndexDeclaration &>();
|
||||
if (!new_indices_set.count(index.name))
|
||||
{
|
||||
out_rename_map["skp_idx_" + index.name + ".idx"] = "";
|
||||
out_rename_map["skp_idx_" + index.name + part->marks_file_extension] = ""; //TODO(alesap) How to deal with it?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1292,8 +1294,8 @@ void MergeTreeData::createConvertExpression(const DataPartPtr & part, const Name
|
||||
String original_file_name = IDataType::getFileNameForStream(original_column_name, substream_path);
|
||||
String temporary_file_name = IDataType::getFileNameForStream(temporary_column_name, substream_path);
|
||||
|
||||
std::cerr << "PART IS NULL:" << (part == nullptr) << std::endl;
|
||||
std::cerr << "PART MARKS FILE_EXTENSION:" << part->marks_file_extension << std::endl;
|
||||
//std::cerr << "PART IS NULL:" << (part == nullptr) << std::endl;
|
||||
//std::cerr << "PART MARKS FILE_EXTENSION:" << part->marks_file_extension << std::endl;
|
||||
out_rename_map[temporary_file_name + ".bin"] = original_file_name + ".bin";
|
||||
out_rename_map[temporary_file_name + part->marks_file_extension] = original_file_name + part->marks_file_extension;
|
||||
}, {});
|
||||
|
@ -20,3 +20,9 @@
|
||||
1
|
||||
8
|
||||
1
|
||||
42 42
|
||||
100 aaaa
|
||||
101 bbbb
|
||||
102 cccc
|
||||
103 dddd
|
||||
7
|
||||
|
@ -131,10 +131,20 @@ SELECT COUNT(*) FROM test.adaptive_granularity_alter;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test';
|
||||
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 5, 3000, 4000), ('2018-05-17', 6, 5000, 6000), ('2018-05-19', 7, 7000, 8000);
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 1, 1000, 2000), ('2018-05-16', 5, 3000, 4000), ('2018-05-17', 6, 5000, 6000), ('2018-05-19', 42, 42, 42);
|
||||
|
||||
SELECT COUNT(*) FROM test.adaptive_granularity_alter;
|
||||
|
||||
SELECT distinct(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test';
|
||||
|
||||
ALTER TABLE test.adaptive_granularity_alter MODIFY COLUMN v2 String;
|
||||
|
||||
INSERT INTO test.adaptive_granularity_alter (p, k, v1, v2) VALUES ('2018-05-15', 100, 1000, 'aaaa'), ('2018-05-16', 101, 3000, 'bbbb'), ('2018-05-17', 102, 5000, 'cccc'), ('2018-05-19', 103, 7000, 'dddd');
|
||||
|
||||
OPTIMIZE TABLE test.adaptive_granularity_alter FINAL;
|
||||
|
||||
SELECT k, v2 FROM test.adaptive_granularity_alter WHERE k >= 100 OR k = 42;
|
||||
|
||||
SELECT sum(marks) from system.parts WHERE table = 'adaptive_granularity_alter' and database='test';
|
||||
|
||||
DROP TABLE IF EXISTS test.adaptive_granularity_alter;
|
||||
|
Loading…
Reference in New Issue
Block a user