diff --git a/velox/dwio/common/compression/Compression.cpp b/velox/dwio/common/compression/Compression.cpp index e0f2597cc699..f5313c57207d 100644 --- a/velox/dwio/common/compression/Compression.cpp +++ b/velox/dwio/common/compression/Compression.cpp @@ -19,6 +19,7 @@ #include "velox/dwio/common/IntCodecCommon.h" #include "velox/dwio/common/compression/PagedInputStream.h" +#include #include #include #include @@ -245,9 +246,10 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( DWIO_ENSURE_GE( compressedSize, dwio::common::INT_BYTE_SIZE, - "{} decompression failed, input len is too small: {}", - kind_, - compressedSize); + fmt::format( + "{} decompression failed, input len is too small: {}", + ::facebook::velox::common::compressionKindToString(kind_), + compressedSize)); uint32_t decompressedBlockSize = folly::Endian::big(folly::loadUnaligned(inputPtr)); @@ -258,12 +260,13 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( DWIO_ENSURE_GE( remainingOutputSize, decompressedBlockSize, - "{} decompression failed, remainingOutputSize is less than " - "decompressedBlockSize, remainingOutputSize: {}, " - "decompressedBlockSize: {}", - kind_, - remainingOutputSize, - decompressedBlockSize); + fmt::format( + "{} decompression failed, remainingOutputSize is less than " + "decompressedBlockSize, remainingOutputSize: {}, " + "decompressedBlockSize: {}", + ::facebook::velox::common::compressionKindToString(kind_), + remainingOutputSize, + decompressedBlockSize)); if (compressedSize <= 0) { break; @@ -274,9 +277,10 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( DWIO_ENSURE_GE( compressedSize, dwio::common::INT_BYTE_SIZE, - "{} decompression failed, input len is too small: {}", - kind_, - compressedSize); + fmt::format( + "{} decompression failed, input len is too small: {}", + ::facebook::velox::common::compressionKindToString(kind_), + compressedSize)); // Read the length of the next lz4/lzo compressed block. uint32_t compressedBlockSize = folly::Endian::big(folly::loadUnaligned(inputPtr)); @@ -286,15 +290,15 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( if (compressedBlockSize == 0) { continue; } - DWIO_ENSURE_LE( compressedBlockSize, compressedSize, - "{} decompression failed, compressedBlockSize is greater than compressedSize, " - "compressedBlockSize: {}, compressedSize: {}", - kind_, - compressedBlockSize, - compressedSize); + fmt::format( + "{} decompression failed, compressedBlockSize is greater than compressedSize, " + "compressedBlockSize: {}, compressedSize: {}", + ::facebook::velox::common::compressionKindToString(kind_), + compressedBlockSize, + compressedSize)); // Decompress this block. remainingOutputSize = uncompressedSize - decompressedTotalSize; @@ -307,11 +311,12 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( DWIO_ENSURE_LE( decompressedSize, remainingOutputSize, - "{} decompression failed, decompressedSize is not less than or equal to remainingOutputSize, " - "decompressedSize: {}, remainingOutputSize: {}", - ::facebook::velox::common::compressionKindToString(kind_), - decompressedSize, - remainingOutputSize); + fmt::format( + "{} decompression failed, decompressedSize is not less than or equal to remainingOutputSize, " + "decompressedSize: {}, remainingOutputSize: {}", + ::facebook::velox::common::compressionKindToString(kind_), + decompressedSize, + remainingOutputSize)); outPtr += decompressedSize; inputPtr += compressedBlockSize; @@ -324,11 +329,12 @@ uint64_t LzoAndLz4DecompressorCommon::decompress( DWIO_ENSURE_EQ( decompressedTotalSize, uncompressedSize, - "{} decompression failed, decompressedTotalSize is not equal to uncompressedSize, " - "decompressedTotalSize: {}, uncompressedSize: {}", - kind_, - decompressedTotalSize, - uncompressedSize); + fmt::format( + "{} decompression failed, decompressedTotalSize is not equal to uncompressedSize, " + "decompressedTotalSize: {}, uncompressedSize: {}", + ::facebook::velox::common::compressionKindToString(kind_), + decompressedTotalSize, + uncompressedSize)); return decompressedTotalSize; }