| 3253 | } |
| 3254 | |
| 3255 | void flushUncompressed( |
| 3256 | const std::vector<std::unique_ptr<VectorStream>>& streams, |
| 3257 | int32_t numRows, |
| 3258 | OutputStream* out, |
| 3259 | PrestoOutputStreamListener* listener) { |
| 3260 | const auto offset = out->tellp(); |
| 3261 | |
| 3262 | char codecMask = 0; |
| 3263 | #ifdef BOLT_ENABLE_CRC |
| 3264 | if (listener) { |
| 3265 | codecMask = getCodecMarker(); |
| 3266 | } |
| 3267 | #endif |
| 3268 | // Pause CRC computation |
| 3269 | if (listener) { |
| 3270 | listener->pause(); |
| 3271 | } |
| 3272 | |
| 3273 | writeInt32(out, numRows); |
| 3274 | out->write(&codecMask, 1); |
| 3275 | |
| 3276 | // Make space for uncompressedSizeInBytes & sizeInBytes |
| 3277 | writeInt32(out, 0); |
| 3278 | writeInt32(out, 0); |
| 3279 | #ifdef BOLT_ENABLE_CRC |
| 3280 | // Write zero checksum. |
| 3281 | writeInt64(out, 0); |
| 3282 | |
| 3283 | // Number of columns and stream content. Unpause CRC. |
| 3284 | if (listener) { |
| 3285 | listener->resume(); |
| 3286 | } |
| 3287 | #endif |
| 3288 | writeInt32(out, streams.size()); |
| 3289 | |
| 3290 | for (auto& stream : streams) { |
| 3291 | stream->flush(out); |
| 3292 | } |
| 3293 | |
| 3294 | #ifdef BOLT_ENABLE_CRC |
| 3295 | // Pause CRC computation |
| 3296 | if (listener) { |
| 3297 | listener->pause(); |
| 3298 | } |
| 3299 | #endif |
| 3300 | |
| 3301 | // Fill in uncompressedSizeInBytes & sizeInBytes |
| 3302 | const auto endOffset = out->tellp(); |
| 3303 | const auto size = static_cast<int64_t>(endOffset - offset); |
| 3304 | BOLT_CHECK( |
| 3305 | size > kHeaderSize, |
| 3306 | "serialized page size {} should exceed header size {}, numRows {}", |
| 3307 | size, |
| 3308 | kHeaderSize, |
| 3309 | numRows); |
| 3310 | |
| 3311 | const int64_t uncompressedSize64 = size - kHeaderSize; |
| 3312 | BOLT_CHECK( |
no test coverage detected