Fix style and includes

This commit is contained in:
alesapin 2018-12-24 17:10:37 +03:00
parent 29ad7f9fb1
commit f2fd1e4da6
4 changed files with 8 additions and 9 deletions

View File

@ -48,7 +48,8 @@ void CompressionCodecLZ4::doDecompressData(const char * source, UInt32 source_si
void registerCodecLZ4(CompressionCodecFactory & factory) void registerCodecLZ4(CompressionCodecFactory & factory)
{ {
factory.registerSimpleCompressionCodec("LZ4", static_cast<UInt8>(CompressionMethodByte::LZ4), [&] () { factory.registerSimpleCompressionCodec("LZ4", static_cast<UInt8>(CompressionMethodByte::LZ4), [&] ()
{
return std::make_shared<CompressionCodecLZ4>(); return std::make_shared<CompressionCodecLZ4>();
}); });
} }
@ -73,7 +74,7 @@ void registerCodecLZ4HC(CompressionCodecFactory & factory)
{ {
factory.registerCompressionCodec("LZ4HC", {}, [&](const ASTPtr & arguments) -> CompressionCodecPtr factory.registerCompressionCodec("LZ4HC", {}, [&](const ASTPtr & arguments) -> CompressionCodecPtr
{ {
int level = LZ4HC_CLEVEL_DEFAULT; int level = 0;
if (arguments && !arguments->children.empty()) if (arguments && !arguments->children.empty())
{ {
@ -83,11 +84,6 @@ void registerCodecLZ4HC(CompressionCodecFactory & factory)
const auto children = arguments->children; const auto children = arguments->children;
const ASTLiteral * literal = static_cast<const ASTLiteral *>(children[0].get()); const ASTLiteral * literal = static_cast<const ASTLiteral *>(children[0].get());
level = literal->value.safeGet<UInt64>(); level = literal->value.safeGet<UInt64>();
if (level > LZ4HC_CLEVEL_MAX || level < LZ4HC_CLEVEL_MIN)
throw Exception("LZ4HC codec can't have level more than "
+ std::to_string(LZ4HC_CLEVEL_MAX) + " and less than "
+ std::to_string(LZ4HC_CLEVEL_MIN) + ", given "
+ std::to_string(level), ErrorCodes::ILLEGAL_CODEC_PARAMETER);
} }
return std::make_shared<CompressionCodecLZ4HC>(level); return std::make_shared<CompressionCodecLZ4HC>(level);

View File

@ -106,7 +106,8 @@ void CompressionCodecMultiple::doDecompressData(const char * source, UInt32 sour
void registerCodecMultiple(CompressionCodecFactory & factory) void registerCodecMultiple(CompressionCodecFactory & factory)
{ {
factory.registerSimpleCompressionCodec("Multiple", static_cast<UInt8>(CompressionMethodByte::Multiple), [&](){ factory.registerSimpleCompressionCodec("Multiple", static_cast<UInt8>(CompressionMethodByte::Multiple), [&] ()
{
return std::make_shared<CompressionCodecMultiple>(); return std::make_shared<CompressionCodecMultiple>();
}); });
} }

View File

@ -29,7 +29,8 @@ void CompressionCodecNone::doDecompressData(const char * source, UInt32 /*source
void registerCodecNone(CompressionCodecFactory & factory) void registerCodecNone(CompressionCodecFactory & factory)
{ {
factory.registerSimpleCompressionCodec("NONE", static_cast<char>(CompressionMethodByte::NONE), [&](){ factory.registerSimpleCompressionCodec("NONE", static_cast<char>(CompressionMethodByte::NONE), [&] ()
{
return std::make_shared<CompressionCodecNone>(); return std::make_shared<CompressionCodecNone>();
}); });
} }

View File

@ -2,6 +2,7 @@
#include <memory> #include <memory>
#include <functional> #include <functional>
#include <optional>
#include <unordered_map> #include <unordered_map>
#include <ext/singleton.h> #include <ext/singleton.h>
#include <Common/IFactoryWithAliases.h> #include <Common/IFactoryWithAliases.h>