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-01-03 14:39:24 +00:00
|
|
|
uint8_t CompressionCodecNone::getMethodByte() const
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
2020-01-03 14:39:24 +00:00
|
|
|
return static_cast<uint8_t>(CompressionMethodByte::NONE);
|
2018-10-11 02:57:48 +00:00
|
|
|
}
|
|
|
|
|
2020-08-28 17:40:45 +00:00
|
|
|
ASTPtr CompressionCodecNone::getCodecDesc() const
|
2018-10-11 02:57:48 +00:00
|
|
|
{
|
2020-08-28 17:40:45 +00:00
|
|
|
return std::make_shared<ASTIdentifier>("NONE");
|
2018-10-11 02:57:48 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|