Outputs method, sizes of uncompressed and compressed blocks for compressed file.
| 50 | |
| 51 | /// Outputs method, sizes of uncompressed and compressed blocks for compressed file. |
| 52 | void checkAndWriteHeader(DB::ReadBuffer & in, DB::WriteBuffer & out) |
| 53 | { |
| 54 | while (!in.eof()) |
| 55 | { |
| 56 | UInt32 size_compressed = {}; |
| 57 | UInt32 size_decompressed = {}; |
| 58 | auto codec = DB::getCompressionCodecForFile(in, size_compressed, size_decompressed, true /* skip_to_next_block */); |
| 59 | |
| 60 | if (size_compressed > DBMS_MAX_COMPRESSED_SIZE) |
| 61 | throw DB::Exception(DB::ErrorCodes::TOO_LARGE_SIZE_COMPRESSED, "Too large size_compressed. Most likely corrupted data."); |
| 62 | |
| 63 | DB::writeText(codec->getFullCodecDesc()->formatWithSecretsOneLine(), out); |
| 64 | DB::writeChar('\t', out); |
| 65 | DB::writeText(size_decompressed, out); |
| 66 | DB::writeChar('\t', out); |
| 67 | DB::writeText(size_compressed, out); |
| 68 | DB::writeChar('\n', out); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | } |
| 73 |
no test coverage detected