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

Method Compress

be/src/util/runtime-profile-serialization.cc:35–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33namespace impala {
34
35Status RuntimeProfile::Compress(vector<uint8_t>* out) const {
36 Status status;
37 TRuntimeProfileTree thrift_object;
38 const_cast<RuntimeProfile*>(this)->ToThrift(&thrift_object);
39 ThriftSerializer serializer(true);
40 vector<uint8_t> serialized_buffer;
41 RETURN_IF_ERROR(serializer.SerializeToVector(&thrift_object, &serialized_buffer));
42
43 // Compress the serialized thrift string. This uses string keys and is very
44 // easy to compress.
45 scoped_ptr<Codec> compressor;
46 Codec::CodecInfo codec_info(THdfsCompression::DEFAULT);
47 RETURN_IF_ERROR(Codec::CreateCompressor(NULL, false, codec_info, &compressor));
48 const auto close_compressor =
49 MakeScopeExitTrigger([&compressor]() { compressor->Close(); });
50
51 int64_t max_compressed_size = compressor->MaxOutputLen(serialized_buffer.size());
52 DCHECK_GT(max_compressed_size, 0);
53 out->resize(max_compressed_size);
54 int64_t result_len = out->size();
55 uint8_t* compressed_buffer_ptr = out->data();
56 RETURN_IF_ERROR(compressor->ProcessBlock(true, serialized_buffer.size(),
57 serialized_buffer.data(), &result_len, &compressed_buffer_ptr));
58 out->resize(result_len);
59 return Status::OK();
60}
61
62Status RuntimeProfile::SerializeToArchiveString(string* out) const {
63 stringstream ss;

Callers

nothing calls this directly

Calls 10

MakeScopeExitTriggerFunction · 0.85
OKFunction · 0.85
SerializeToVectorMethod · 0.80
resizeMethod · 0.80
ToThriftMethod · 0.45
CloseMethod · 0.45
MaxOutputLenMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
ProcessBlockMethod · 0.45

Tested by

no test coverage detected