MCPcopy Create free account
hub / github.com/bytedance/bolt / flushSerialization

Function flushSerialization

bolt/serializers/PrestoSerializer.cpp:3335–3373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3333}
3334
3335void 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
3375void flushCompressed(
3376 const std::vector<std::unique_ptr<VectorStream>>& streams,

Callers 1

flushCompressedFunction · 0.85

Calls 10

computeChecksumFunction · 0.85
writeInt32Function · 0.70
writeInt64Function · 0.70
writeMethod · 0.45
tellpMethod · 0.45
resumeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
pauseMethod · 0.45
seekpMethod · 0.45

Tested by

no test coverage detected