mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Remove ridiculous code
This commit is contained in:
parent
9dc91e3ee4
commit
0c8e12affd
@ -166,7 +166,8 @@ void registerCodecDelta(CompressionCodecFactory & factory)
|
||||
UInt8 method_code = UInt8(CompressionMethodByte::Delta);
|
||||
factory.registerCompressionCodecWithType("Delta", method_code, [&](const ASTPtr & arguments, DataTypePtr column_type) -> CompressionCodecPtr
|
||||
{
|
||||
UInt8 delta_bytes_size = getDeltaBytesSize(column_type);
|
||||
UInt8 delta_bytes_size;
|
||||
|
||||
if (arguments && !arguments->children.empty())
|
||||
{
|
||||
if (arguments->children.size() > 1)
|
||||
@ -182,6 +183,11 @@ void registerCodecDelta(CompressionCodecFactory & factory)
|
||||
throw Exception("Delta value for delta codec can be 1, 2, 4 or 8, given " + toString(user_bytes_size), ErrorCodes::ILLEGAL_CODEC_PARAMETER);
|
||||
delta_bytes_size = static_cast<UInt8>(user_bytes_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta_bytes_size = getDeltaBytesSize(column_type);
|
||||
}
|
||||
|
||||
return std::make_shared<CompressionCodecDelta>(delta_bytes_size);
|
||||
});
|
||||
}
|
||||
|
@ -30,7 +30,4 @@ private:
|
||||
UInt8 delta_bytes_size;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecDelta(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -419,8 +419,12 @@ void CompressionCodecDoubleDelta::useInfoAboutType(DataTypePtr data_type)
|
||||
void registerCodecDoubleDelta(CompressionCodecFactory & factory)
|
||||
{
|
||||
UInt8 method_code = UInt8(CompressionMethodByte::DoubleDelta);
|
||||
factory.registerCompressionCodecWithType("DoubleDelta", method_code, [&](const ASTPtr &, DataTypePtr column_type) -> CompressionCodecPtr
|
||||
factory.registerCompressionCodecWithType("DoubleDelta", method_code,
|
||||
[&](const ASTPtr & arguments, DataTypePtr column_type) -> CompressionCodecPtr
|
||||
{
|
||||
if (arguments)
|
||||
throw Exception("Codec DoubleDelta does not accept any arguments", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
UInt8 delta_bytes_size = getDataBytesSize(column_type);
|
||||
return std::make_shared<CompressionCodecDoubleDelta>(delta_bytes_size);
|
||||
});
|
||||
|
@ -116,7 +116,4 @@ private:
|
||||
UInt8 data_bytes_size;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecDoubleDelta(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -336,10 +336,14 @@ void CompressionCodecGorilla::useInfoAboutType(DataTypePtr data_type)
|
||||
void registerCodecGorilla(CompressionCodecFactory & factory)
|
||||
{
|
||||
UInt8 method_code = UInt8(CompressionMethodByte::Gorilla);
|
||||
factory.registerCompressionCodecWithType("Gorilla", method_code, [&](const ASTPtr &, DataTypePtr column_type) -> CompressionCodecPtr
|
||||
factory.registerCompressionCodecWithType("Gorilla", method_code,
|
||||
[&](const ASTPtr & arguments, DataTypePtr column_type) -> CompressionCodecPtr
|
||||
{
|
||||
UInt8 delta_bytes_size = getDataBytesSize(column_type);
|
||||
return std::make_shared<CompressionCodecGorilla>(delta_bytes_size);
|
||||
if (arguments)
|
||||
throw Exception("Codec Gorilla does not accept any arguments", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
UInt8 data_bytes_size = getDataBytesSize(column_type);
|
||||
return std::make_shared<CompressionCodecGorilla>(data_bytes_size);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,4 @@ private:
|
||||
UInt8 data_bytes_size;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecGorilla(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ private:
|
||||
mutable LZ4::PerformanceStatistics lz4_stat;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecLZ4(CompressionCodecFactory & factory);
|
||||
|
||||
class CompressionCodecLZ4HC : public CompressionCodecLZ4
|
||||
{
|
||||
@ -50,7 +48,4 @@ private:
|
||||
const int level;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecLZ4HC(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -155,12 +155,4 @@ bool CompressionCodecMultiple::isCompression() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void registerCodecMultiple(CompressionCodecFactory & factory)
|
||||
{
|
||||
factory.registerSimpleCompressionCodec("Multiple", static_cast<UInt8>(CompressionMethodByte::Multiple), [&] ()
|
||||
{
|
||||
return std::make_shared<CompressionCodecMultiple>();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace DB
|
||||
class CompressionCodecMultiple final : public ICompressionCodec
|
||||
{
|
||||
public:
|
||||
CompressionCodecMultiple() = default;
|
||||
CompressionCodecMultiple(Codecs codecs_, bool sanity_check);
|
||||
|
||||
uint8_t getMethodByte() const override;
|
||||
@ -33,8 +32,4 @@ private:
|
||||
String getCodecDescImpl() const;
|
||||
};
|
||||
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecMultiple(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,4 @@ protected:
|
||||
bool isNone() const override { return true; }
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecNone(CompressionCodecFactory & factory);
|
||||
}
|
||||
|
@ -56,7 +56,4 @@ private:
|
||||
Variant variant;
|
||||
};
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecT64(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -33,8 +33,4 @@ private:
|
||||
const int level;
|
||||
};
|
||||
|
||||
|
||||
class CompressionCodecFactory;
|
||||
void registerCodecZSTD(CompressionCodecFactory & factory);
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <IO/ReadBuffer.h>
|
||||
#include <Parsers/queryToString.h>
|
||||
#include <Compression/CompressionCodecMultiple.h>
|
||||
#include <Compression/CompressionCodecLZ4.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
|
||||
|
||||
@ -146,6 +145,8 @@ void CompressionCodecFactory::registerSimpleCompressionCodec(
|
||||
|
||||
|
||||
void registerCodecNone(CompressionCodecFactory & factory);
|
||||
void registerCodecLZ4(CompressionCodecFactory & factory);
|
||||
void registerCodecLZ4HC(CompressionCodecFactory & factory);
|
||||
void registerCodecZSTD(CompressionCodecFactory & factory);
|
||||
void registerCodecDelta(CompressionCodecFactory & factory);
|
||||
void registerCodecT64(CompressionCodecFactory & factory);
|
||||
@ -154,16 +155,16 @@ void registerCodecGorilla(CompressionCodecFactory & factory);
|
||||
|
||||
CompressionCodecFactory::CompressionCodecFactory()
|
||||
{
|
||||
default_codec = std::make_shared<CompressionCodecLZ4>();
|
||||
registerCodecLZ4(*this);
|
||||
registerCodecNone(*this);
|
||||
registerCodecZSTD(*this);
|
||||
registerCodecMultiple(*this);
|
||||
registerCodecLZ4HC(*this);
|
||||
registerCodecDelta(*this);
|
||||
registerCodecT64(*this);
|
||||
registerCodecDoubleDelta(*this);
|
||||
registerCodecGorilla(*this);
|
||||
|
||||
default_codec = get("LZ4", {}, false);
|
||||
}
|
||||
|
||||
CompressionCodecFactory & CompressionCodecFactory::instance()
|
||||
|
@ -5,3 +5,6 @@ CREATE TABLE delta_codec_synthetic (`id` UInt64 NULL CODEC(Gorilla, ZSTD(22))) E
|
||||
CREATE TABLE delta_codec_synthetic (`id` Decimal(38, 10) CODEC(Delta, ZSTD(22))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 36 }
|
||||
CREATE TABLE delta_codec_synthetic (`id` Decimal(38, 10) CODEC(DoubleDelta, ZSTD(22))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 36 }
|
||||
CREATE TABLE delta_codec_synthetic (`id` Decimal(38, 10) CODEC(Gorilla, ZSTD(22))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 36 }
|
||||
|
||||
CREATE TABLE delta_codec_synthetic (`id` UInt64 CODEC(DoubleDelta(3), ZSTD(22))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 36 }
|
||||
CREATE TABLE delta_codec_synthetic (`id` UInt64 CODEC(Gorilla('hello, world'), ZSTD(22))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 36 }
|
||||
|
Loading…
Reference in New Issue
Block a user