MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / validateCodec

Method validateCodec

src/Compression/CompressionFactoryAdditions.cpp:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37void CompressionCodecFactory::validateCodec(
38 const String & family_name, std::optional<int> level, bool sanity_check, bool allow_experimental_codecs) const
39{
40 if (family_name.empty())
41 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Compression codec name cannot be empty");
42
43 if (level)
44 {
45 auto literal = make_intrusive<ASTLiteral>(static_cast<UInt64>(*level));
46 validateCodecAndGetPreprocessedAST(makeASTFunction("CODEC", makeASTFunction(Poco::toUpper(family_name), literal)),
47 {}, sanity_check, allow_experimental_codecs);
48 }
49 else
50 {
51 auto identifier = make_intrusive<ASTIdentifier>(Poco::toUpper(family_name));
52 validateCodecAndGetPreprocessedAST(makeASTFunction("CODEC", identifier),
53 {}, sanity_check, allow_experimental_codecs);
54 }
55}
56
57namespace
58{

Callers 3

writeToShardMethod · 0.80
getCompressionCodecMethod · 0.80
sendQueryMethod · 0.80

Calls 4

toUpperFunction · 0.85
ExceptionClass · 0.70
makeASTFunctionFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected