Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
lzyy2024 committed Jan 30, 2025
1 parent 72fafec commit 23e089b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions be/src/vec/functions/function_compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.
#include <glog/logging.h>

#include <array>
#include <cctype>
#include <cstddef>
#include <cstring>
Expand Down Expand Up @@ -52,7 +53,8 @@ class FunctionContext;
namespace doris::vectorized {

class FunctionCompress : public IFunction {
string hex_itoc = "0123456789ABCDEF";
std::array<char, 16> hex_itoc = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};

public:
static constexpr auto name = "compress";
Expand Down Expand Up @@ -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);
Expand All @@ -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';
Expand Down

0 comments on commit 23e089b

Please sign in to comment.