From 23e089b95f2a690fe4e2f913b1ec7550fceabdd3 Mon Sep 17 00:00:00 2001 From: lzyy2024 <2972013149@qq.com> Date: Thu, 30 Jan 2025 09:54:20 +0800 Subject: [PATCH] amend --- be/src/vec/functions/function_compress.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/be/src/vec/functions/function_compress.cpp b/be/src/vec/functions/function_compress.cpp index 9d0dd9c044cd45..1d17cef8d6c1ae 100644 --- a/be/src/vec/functions/function_compress.cpp +++ b/be/src/vec/functions/function_compress.cpp @@ -16,6 +16,7 @@ // under the License. #include +#include #include #include #include @@ -52,7 +53,8 @@ class FunctionContext; namespace doris::vectorized { class FunctionCompress : public IFunction { - string hex_itoc = "0123456789ABCDEF"; + std::array hex_itoc = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; public: static constexpr auto name = "compress"; @@ -96,9 +98,6 @@ class FunctionCompress : public IFunction { size_t length = arg_offset[row] - arg_offset[row - 1]; data = Slice(arg_begin + arg_offset[row - 1], length); - // Z_MEM_ERROR and Z_BUF_ERROR are already handled in compress, making sure st is always Z_OK - auto st = compression_codec->compress(data, &compressed_str); - size_t idx = col_data.size(); if (!length) { // data is '' col_data.resize(col_data.size() + 2); @@ -107,6 +106,9 @@ class FunctionCompress : public IFunction { continue; } + // Z_MEM_ERROR and Z_BUF_ERROR are already handled in compress, making sure st is always Z_OK + auto st = compression_codec->compress(data, &compressed_str); + // first ten digits represent the length of the uncompressed string col_data.resize(col_data.size() + 10 + 2 * compressed_str.size()); col_data[idx] = '0', col_data[idx + 1] = 'x';