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

Method RunTest

be/src/util/decompress-test.cc:68–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 }
67
68 void RunTest(THdfsCompression::type format, std::optional<int> clevel = std::nullopt) {
69 scoped_ptr<Codec> compressor;
70 scoped_ptr<Codec> decompressor;
71
72 Codec::CodecInfo codec_info = Codec::CodecInfo(format, clevel);
73
74 EXPECT_OK(Codec::CreateCompressor(&mem_pool_, true, codec_info, &compressor));
75 EXPECT_OK(Codec::CreateDecompressor(&mem_pool_, true, format, &decompressor));
76
77 // LZ4 & ZSTD are not implemented to work without an allocated output
78 if (format == THdfsCompression::LZ4 || format == THdfsCompression::ZSTD ||
79 format == THdfsCompression::LZ4_BLOCKED) {
80 CompressAndDecompressNoOutputAllocated(compressor.get(), decompressor.get(),
81 sizeof(input_), input_);
82 CompressAndDecompressNoOutputAllocated(compressor.get(), decompressor.get(),
83 0, NULL);
84 } else {
85 CompressAndDecompress(compressor.get(), decompressor.get(), sizeof(input_), input_);
86 // Test with odd-length input (to test the calculation of block-sizes in
87 // SnappyBlockCompressor)
88 CompressAndDecompress(compressor.get(), decompressor.get(), sizeof(input_) - 1,
89 input_);
90 // Test with input length of 1024 (to test SnappyBlockCompressor with a single
91 // block)
92 CompressAndDecompress(compressor.get(), decompressor.get(), 1024, input_);
93 // Test with empty input
94 if (format != THdfsCompression::BZIP2) {
95 CompressAndDecompress(compressor.get(), decompressor.get(), 0, NULL);
96 } else {
97 // bzip does not allow NULL input
98 CompressAndDecompress(compressor.get(), decompressor.get(), 0, input_);
99 }
100 }
101 DecompressOverUnderSizedOutputBuffer(compressor.get(), decompressor.get(),
102 sizeof(input_), input_);
103 compressor->Close();
104 decompressor->Close();
105 }
106
107 void RunTestStreaming(THdfsCompression::type format,
108 std::optional<int> compression_level = std::nullopt) {

Callers

nothing calls this directly

Calls 4

CodecInfoClass · 0.85
CompressAndDecompressFunction · 0.85
getMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected