| 35 | |
| 36 | |
| 37 | void 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 | |
| 57 | namespace |
| 58 | { |
no test coverage detected