Remove another chunk of unneeded code

This commit is contained in:
Alexey Milovidov 2020-07-09 04:07:18 +03:00
parent 3cc9fd5b8f
commit a01a61c179
5 changed files with 28 additions and 44 deletions

View File

@ -137,21 +137,16 @@ namespace
UInt8 getDeltaBytesSize(DataTypePtr column_type) UInt8 getDeltaBytesSize(DataTypePtr column_type)
{ {
UInt8 delta_bytes_size = 1; if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
if (column_type) throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is not applicable for {} because the data type is not of fixed size",
{ column_type->getName());
if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is not applicable for {} because the data type is not of fixed size",
column_type->getName());
size_t max_size = column_type->getSizeOfValueInMemory(); size_t max_size = column_type->getSizeOfValueInMemory();
if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8) if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8)
delta_bytes_size = static_cast<UInt8>(max_size); return static_cast<UInt8>(max_size);
else else
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}", throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}",
column_type->getName()); column_type->getName());
}
return delta_bytes_size;
} }
} }

View File

@ -308,21 +308,16 @@ void decompressDataForType(const char * source, UInt32 source_size, char * dest)
UInt8 getDataBytesSize(DataTypePtr column_type) UInt8 getDataBytesSize(DataTypePtr column_type)
{ {
UInt8 data_bytes_size = 1; if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
if (column_type) throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec DoubleDelta is not applicable for {} because the data type is not of fixed size",
{ column_type->getName());
if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec DoubleDelta is not applicable for {} because the data type is not of fixed size",
column_type->getName());
size_t max_size = column_type->getSizeOfValueInMemory(); size_t max_size = column_type->getSizeOfValueInMemory();
if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8) if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8)
data_bytes_size = static_cast<UInt8>(max_size); return static_cast<UInt8>(max_size);
else else
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}", throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}",
column_type->getName()); column_type->getName());
}
return data_bytes_size;
} }
} }

View File

@ -224,21 +224,16 @@ void decompressDataForType(const char * source, UInt32 source_size, char * dest)
UInt8 getDataBytesSize(DataTypePtr column_type) UInt8 getDataBytesSize(DataTypePtr column_type)
{ {
UInt8 delta_bytes_size = 1; if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
if (column_type) throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Gorilla is not applicable for {} because the data type is not of fixed size",
{ column_type->getName());
if (!column_type->isValueUnambiguouslyRepresentedInFixedSizeContiguousMemoryRegion())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Gorilla is not applicable for {} because the data type is not of fixed size",
column_type->getName());
size_t max_size = column_type->getSizeOfValueInMemory(); size_t max_size = column_type->getSizeOfValueInMemory();
if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8) if (max_size == 1 || max_size == 2 || max_size == 4 || max_size == 8)
delta_bytes_size = static_cast<UInt8>(max_size); return static_cast<UInt8>(max_size);
else else
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}", throw Exception(ErrorCodes::BAD_ARGUMENTS, "Codec Delta is only applicable for data types of size 1, 2, 4, 8 bytes. Given type {}",
column_type->getName()); column_type->getName());
}
return delta_bytes_size;
} }
} }

View File

@ -108,9 +108,7 @@ UInt32 CompressionCodecMultiple::doCompressData(const char * source, UInt32 sour
void CompressionCodecMultiple::useInfoAboutType(const DataTypePtr & data_type) void CompressionCodecMultiple::useInfoAboutType(const DataTypePtr & data_type)
{ {
for (auto & codec : codecs) for (auto & codec : codecs)
{
codec->useInfoAboutType(data_type); codec->useInfoAboutType(data_type);
}
} }
void CompressionCodecMultiple::doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 decompressed_size) const void CompressionCodecMultiple::doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 decompressed_size) const

View File

@ -3,6 +3,7 @@
#include <Core/Types.h> #include <Core/Types.h>
#include <Compression/ICompressionCodec.h> #include <Compression/ICompressionCodec.h>
namespace DB namespace DB
{ {