mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
in-memory parts: fix columns sizes
This commit is contained in:
parent
df3dfd5b81
commit
b312ac9786
@ -113,9 +113,15 @@ void MergeTreeDataPartInMemory::renameTo(const String & new_relative_path, bool
|
||||
relative_path = new_relative_path;
|
||||
}
|
||||
|
||||
void MergeTreeDataPartInMemory::calculateEachColumnSizesOnDisk(ColumnSizeByName & /*each_columns_size*/, ColumnSize & /*total_size*/) const
|
||||
/// Calculates uncompressed sizes in memory.
|
||||
void MergeTreeDataPartInMemory::calculateEachColumnSizesOnDisk(ColumnSizeByName & each_columns_size, ColumnSize & total_size) const
|
||||
{
|
||||
// throw Exception("calculateEachColumnSizesOnDisk of in memory part", ErrorCodes::NOT_IMPLEMENTED);
|
||||
auto it = checksums.files.find("data.bin");
|
||||
if (it != checksums.files.end())
|
||||
total_size.data_uncompressed += it->second.uncompressed_size;
|
||||
|
||||
for (const auto & column : columns)
|
||||
each_columns_size[column.name].data_uncompressed += block.getByName(column.name).column->byteSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ struct MergeTreeSettings : public SettingsCollection<MergeTreeSettings>
|
||||
M(SettingUInt64, min_rows_for_wide_part, 0, "Minimal number of rows to create part in wide format instead of compact", 0) \
|
||||
M(SettingUInt64, min_bytes_for_compact_part, 0, "Minimal uncompressed size in bytes to create part in compact format instead of saving it in RAM", 0) \
|
||||
M(SettingUInt64, min_rows_for_compact_part, 0, "Minimal number of rows to create part in compact format instead of saving it in RAM", 0) \
|
||||
M(SettingBool, in_memory_parts_enable_wal, 1, "Whether to write blocks in Native format to write-ahead-log before creation in-memory part", 0) \
|
||||
M(SettingBool, in_memory_parts_insert_sync, 0, "", 0) \
|
||||
M(SettingBool, in_memory_parts_enable_wal, true, "Whether to write blocks in Native format to write-ahead-log before creation in-memory part", 0) \
|
||||
M(SettingBool, in_memory_parts_insert_sync, false, "If true and in-memory parts are enabled, insert will wait while part will persist on disk in result of merge", 0) \
|
||||
M(SettingUInt64, write_ahead_log_max_bytes, 1024 * 1024 * 1024, "Rotate WAL, if it exceeds that amount of bytes", 0) \
|
||||
\
|
||||
/** Merge settings. */ \
|
||||
|
@ -112,7 +112,7 @@ void MergedBlockOutputStream::writeSuffixAndFinalizePart(
|
||||
new_part->checksums = checksums;
|
||||
new_part->setBytesOnDisk(checksums.getTotalSizeOnDisk());
|
||||
new_part->index_granularity = writer->getIndexGranularity();
|
||||
// new_part->calculateColumnsSizesOnDisk(); // TODO: Fix
|
||||
new_part->calculateColumnsSizesOnDisk();
|
||||
}
|
||||
|
||||
void MergedBlockOutputStream::finalizePartOnDisk(
|
||||
|
@ -1,4 +1,7 @@
|
||||
system.parts
|
||||
InMemory 2
|
||||
1
|
||||
1
|
||||
Simple selects
|
||||
0 0
|
||||
1 1
|
||||
|
@ -4,7 +4,10 @@ CREATE TABLE in_memory (a UInt32, b UInt32)
|
||||
SETTINGS min_rows_for_compact_part = 1000, min_rows_for_compact_part = 1000;
|
||||
|
||||
INSERT INTO in_memory SELECT number, number % 3 FROM numbers(100);
|
||||
SELECT 'system.parts';
|
||||
SELECT DISTINCT part_type, marks FROM system.parts WHERE database = currentDatabase() AND table = 'in_memory' AND active;
|
||||
SELECT DISTINCT data_uncompressed_bytes > 0 FROM system.parts WHERE database = currentDatabase() AND table = 'in_memory' AND active;
|
||||
SELECT DISTINCT column_data_uncompressed_bytes > 0 FROM system.parts_columns WHERE database = currentDatabase() AND table = 'in_memory' AND active;
|
||||
|
||||
SELECT 'Simple selects';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user