| 3333 | } |
| 3334 | |
| 3335 | void flushSerialization( |
| 3336 | int32_t numRows, |
| 3337 | int32_t uncompressedSize, |
| 3338 | int32_t serializationSize, |
| 3339 | char codecMask, |
| 3340 | const std::unique_ptr<folly::IOBuf>& iobuf, |
| 3341 | OutputStream* output, |
| 3342 | PrestoOutputStreamListener* listener) { |
| 3343 | output->write(&codecMask, 1); |
| 3344 | writeInt32(output, uncompressedSize); |
| 3345 | writeInt32(output, serializationSize); |
| 3346 | #ifdef BOLT_ENABLE_CRC |
| 3347 | auto crcOffset = output->tellp(); |
| 3348 | // Write zero checksum |
| 3349 | writeInt64(output, 0); |
| 3350 | // Number of columns and stream content. Unpause CRC. |
| 3351 | if (listener) { |
| 3352 | listener->resume(); |
| 3353 | } |
| 3354 | #endif |
| 3355 | for (auto range : *iobuf) { |
| 3356 | output->write(reinterpret_cast<const char*>(range.data()), range.size()); |
| 3357 | } |
| 3358 | #ifdef BOLT_ENABLE_CRC |
| 3359 | // Pause CRC computation |
| 3360 | if (listener) { |
| 3361 | listener->pause(); |
| 3362 | } |
| 3363 | const auto endSize = output->tellp(); |
| 3364 | // Fill in crc |
| 3365 | int64_t crc = 0; |
| 3366 | if (listener) { |
| 3367 | crc = computeChecksum(listener, codecMask, numRows, uncompressedSize); |
| 3368 | } |
| 3369 | output->seekp(crcOffset); |
| 3370 | writeInt64(output, crc); |
| 3371 | output->seekp(endSize); |
| 3372 | #endif |
| 3373 | } |
| 3374 | |
| 3375 | void flushCompressed( |
| 3376 | const std::vector<std::unique_ptr<VectorStream>>& streams, |
no test coverage detected