MCPcopy Create free account
hub / github.com/apache/arrow / Compress

Method Compress

cpp/src/arrow/util/compression_zstd.cc:101–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 explicit ZSTDCompressor(CCtxPtr stream) : stream_(std::move(stream)) {}
100
101 Result<CompressResult> Compress(int64_t input_len, const uint8_t* input,
102 int64_t output_len, uint8_t* output) override {
103 ZSTD_inBuffer in_buf;
104 ZSTD_outBuffer out_buf;
105
106 in_buf.src = input;
107 in_buf.size = static_cast<size_t>(input_len);
108 in_buf.pos = 0;
109 out_buf.dst = output;
110 out_buf.size = static_cast<size_t>(output_len);
111 out_buf.pos = 0;
112
113 size_t ret;
114 ret = ZSTD_compressStream(stream_.get(), &out_buf, &in_buf);
115 if (ZSTD_isError(ret)) {
116 return ZSTDError(ret, "ZSTD compress failed: ");
117 }
118 return CompressResult{static_cast<int64_t>(in_buf.pos),
119 static_cast<int64_t>(out_buf.pos)};
120 }
121
122 Result<FlushResult> Flush(int64_t output_len, uint8_t* output) override {
123 ZSTD_outBuffer out_buf;

Callers

nothing calls this directly

Calls 2

ZSTDErrorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected