Default codec if part is not stored on disk

This commit is contained in:
alesapin 2020-08-27 16:32:23 +03:00
parent 0ff5e5412e
commit d426751e26

View File

@ -486,7 +486,10 @@ bool IMergeTreeDataPart::loadDefaultCompressionCodec()
{
/// In memory parts doesn't have any compression
if (!isStoredOnDisk())
{
default_codec = CompressionCodecFactory::instance().get("NONE", {});
return true;
}
String path = getFullRelativePath() + DEFAULT_COMPRESSION_CODEC_FILE_NAME;
if (!volume->getDisk()->exists(path))
@ -522,9 +525,13 @@ bool IMergeTreeDataPart::loadDefaultCompressionCodec()
void IMergeTreeDataPart::detectAndSetDefaultCompressionCodec(size_t total_storage_size)
{
default_codec = storage.global_context.chooseCompressionCodec(
getBytesOnDisk(),
static_cast<double>(getBytesOnDisk()) / total_storage_size);
/// In memory parts doesn't have any compression
if (isStoredOnDisk())
default_codec
= storage.global_context.chooseCompressionCodec(getBytesOnDisk(),
static_cast<double>(getBytesOnDisk()) / total_storage_size);
else
default_codec = CompressionCodecFactory::instance().get("NONE", {});
}
void IMergeTreeDataPart::loadPartitionAndMinMaxIndex()