2018-10-11 02:57:48 +00:00
|
|
|
#include <Compression/CompressionCodecNone.h>
|
2018-12-21 13:25:39 +00:00
|
|
|
#include <Compression/CompressionInfo.h>
|
2018-10-11 02:57:48 +00:00
|
|
|
#include <Compression/CompressionFactory.h>
|
2020-08-28 17:40:45 +00:00
|
|
|
#include <Parsers/ASTIdentifier.h>
|
2018-10-11 02:57:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-09-14 19:15:25 +00:00
|
|
|
CompressionCodecNone::CompressionCodecNone()
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
2020-09-14 19:15:25 +00:00
|
|
|
setCodecDescription("NONE");
|
2018-10-11 02:57:48 +00:00
|
|
|
}
|
|
|
|
|
2020-09-14 19:15:25 +00:00
|
|
|
uint8_t CompressionCodecNone::getMethodByte() const
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
2020-09-14 19:15:25 +00:00
|
|
|
return static_cast<uint8_t>(CompressionMethodByte::NONE);
|
2018-10-11 02:57:48 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 22:04:46 +00:00
|
|
|
void CompressionCodecNone::updateHash(SipHash & hash) const
|
|
|
|
{
|
|
|
|
getCodecDesc()->updateTreeHash(hash);
|
|
|
|
}
|
|
|
|
|
2018-12-19 17:20:18 +00:00
|
|
|
UInt32 CompressionCodecNone::doCompressData(const char * source, UInt32 source_size, char * dest) const
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
|
|
|
memcpy(dest, source, source_size);
|
|
|
|
return source_size;
|
|
|
|
}
|
|
|
|
|
2018-12-19 17:20:18 +00:00
|
|
|
void CompressionCodecNone::doDecompressData(const char * source, UInt32 /*source_size*/, char * dest, UInt32 uncompressed_size) const
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
2018-12-19 17:20:18 +00:00
|
|
|
memcpy(dest, source, uncompressed_size);
|
2018-10-11 02:57:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void registerCodecNone(CompressionCodecFactory & factory)
|
|
|
|
{
|
2018-12-24 14:10:37 +00:00
|
|
|
factory.registerSimpleCompressionCodec("NONE", static_cast<char>(CompressionMethodByte::NONE), [&] ()
|
|
|
|
{
|
2018-10-11 02:57:48 +00:00
|
|
|
return std::make_shared<CompressionCodecNone>();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-12-18 13:08:22 +00:00
|
|
|
}
|