Don't use switch

This commit is contained in:
Kruglov Pavel 2023-03-06 18:03:17 +01:00 committed by GitHub
parent d8e5fb5195
commit df34ab240d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,22 +36,24 @@ namespace
orc::CompressionKind getORCCompression(FormatSettings::ORCCompression method) orc::CompressionKind getORCCompression(FormatSettings::ORCCompression method)
{ {
switch (method) if (method == FormatSettings::ORCCompression::NONE)
{ return orc::CompressionKind::CompressionKind_NONE;
case FormatSettings::ORCCompression::NONE:
return orc::CompressionKind::CompressionKind_NONE;
case FormatSettings::ORCCompression::SNAPPY:
#if USE_SNAPPY #if USE_SNAPPY
return orc::CompressionKind::CompressionKind_SNAPPY; if (method == FormatSettings::ORCCompression::SNAPPY)
return orc::CompressionKind::CompressionKind_SNAPPY;
#endif #endif
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Snappy compression method is not supported");
case FormatSettings::ORCCompression::ZSTD: if (method == FormatSettings::ORCCompression::ZSTD)
return orc::CompressionKind::CompressionKind_ZSTD; return orc::CompressionKind::CompressionKind_ZSTD;
case FormatSettings::ORCCompression::LZ4:
return orc::CompressionKind::CompressionKind_LZ4; if (method == FormatSettings::ORCCompression::LZ4)
case FormatSettings::ORCCompression::ZLIB: return orc::CompressionKind::CompressionKind_LZ4;
return orc::CompressionKind::CompressionKind_ZLIB;
} if (method == FormatSettings::ORCCompression::ZLIB)
return orc::CompressionKind::CompressionKind_ZLIB;
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported compression method");
} }
} }