fix tests

This commit is contained in:
CurtizJ 2020-01-22 17:10:35 +03:00
parent 8183a79100
commit 771e429d35
4 changed files with 15 additions and 25 deletions

View File

@ -520,7 +520,7 @@ void IMergeTreeDataPart::loadRowsCount()
{
rows_count = 0;
}
else if (storage.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
else if (storage.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING || part_type == Type::COMPACT)
{
if (!Poco::File(path).exists())
throw Exception("No count.txt in part " + name, ErrorCodes::NO_FILE_IN_DATA_PART);
@ -531,14 +531,6 @@ void IMergeTreeDataPart::loadRowsCount()
}
else
{
if (Poco::File(path).exists())
{
ReadBufferFromFile file = openForReading(path);
readIntText(rows_count, file);
assertEOF(file);
return;
}
for (const NameAndTypePair & column : columns)
{
ColumnPtr column_col = column.type->createColumn();

View File

@ -98,7 +98,7 @@ void MergedBlockOutputStream::writeSuffixAndFinalizePart(
if (!total_column_list)
total_column_list = &columns_list;
if (storage.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
if (storage.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING || isCompactPart(new_part))
{
new_part->partition.store(storage, part_path, checksums);
if (new_part->minmax_idx.initialized)
@ -106,9 +106,7 @@ void MergedBlockOutputStream::writeSuffixAndFinalizePart(
else if (rows_count)
throw Exception("MinMax index was not initialized for new non-empty part " + new_part->name
+ ". It is a bug.", ErrorCodes::LOGICAL_ERROR);
}
{
WriteBufferFromFile count_out(part_path + "count.txt", 4096);
HashingWriteBuffer count_out_hashing(count_out);
writeIntText(rows_count, count_out_hashing);

View File

@ -12,29 +12,29 @@
Compact
Compact 7
Wide 3
0 0 1167657 [1,2] ['',''] 0
0 0 1167657 [0,0,0] ['a','b','c'] baz
0 0 1748245 [1,2] ['',''] 3
1 1 2072334 [1,2] ['',''] 1
0 0 645645 [1,2] ['',''] 0
0 0 804292 [1,2] ['',''] 3
1 1 1409675 [1,2] ['',''] 1
1 1 1568322 [1,2] ['',''] 4
1 1 2072334 [0,0,0] ['a','b','c'] bar
1 1 519479 [1,2] ['',''] 4
2 4 40262 [1,2] ['',''] 2
2 4 843568 [0,0,0] ['a','b','c'] baz
2 4 843568 [1,2] ['',''] 2
3 9 1748245 [0,0,0] ['a','b','c'] bar
4 16 519479 [0,0,0] ['a','b','c'] baz
=====================
0 0 1167657 [1,2] ['qwqw'] 0
0 0 1167657 [0,0,0] ['qwqw'] baz
0 0 1748245 [1,2] ['qwqw'] 3
1 1 2072334 [1,2] ['qwqw'] 1
0 0 645645 [1,2] ['qwqw'] 0
0 0 804292 [1,2] ['qwqw'] 3
1 1 1409675 [1,2] ['qwqw'] 1
1 1 1568322 [1,2] ['qwqw'] 4
1 1 2072334 [0,0,0] ['qwqw'] bar
1 1 519479 [1,2] ['qwqw'] 4
2 4 40262 [1,2] ['qwqw'] 2
2 4 843568 [0,0,0] ['qwqw'] baz
2 4 843568 [1,2] ['qwqw'] 2
3 9 1748245 [0,0,0] ['qwqw'] bar
4 16 519479 [0,0,0] ['qwqw'] baz
=====================
2 42 843568 [1,2] ['qwqw'] 2
2 42 40262 [1,2] ['qwqw'] 2
2 42 843568 [0,0,0] ['qwqw'] baz
3 42 1748245 [0,0,0] ['qwqw'] bar
4 42 519479 [0,0,0] ['qwqw'] baz

View File

@ -21,11 +21,11 @@ ${CLICKHOUSE_CLIENT} --query="select '=====================';"
${CLICKHOUSE_CLIENT} --query="select distinct part_type from system.parts where database = currentDatabase() and table = 'mt_compact' and active;"
${CLICKHOUSE_CLIENT} --query="insert into mt_compact (a, s, n.x, lc) select number % 3, toString((number * 2132214234 + 5434543) % 2133443), [1, 2], toString(number) from numbers(5);"
${CLICKHOUSE_CLIENT} --query="insert into mt_compact (a, s, n.x, lc) select number % 3, toString((number * 75434535 + 645645) % 2133443), [1, 2], toString(number) from numbers(5);"
${CLICKHOUSE_CLIENT} --query="optimize table mt_compact final;"
${CLICKHOUSE_CLIENT} --query="select part_type, count() from system.parts where database = currentDatabase() and table = 'mt_compact' and active group by part_type; "
${CLICKHOUSE_CLIENT} --query="select part_type, count() from system.parts where database = currentDatabase() and table = 'mt_compact' and active group by part_type order by part_type; "
${CLICKHOUSE_CLIENT} --query="select * from mt_compact order by a, s limit 10;"
${CLICKHOUSE_CLIENT} --query="select '=====================';"