| 465 | } |
| 466 | |
| 467 | void WriterImpl::init() { |
| 468 | // Write file header |
| 469 | const static size_t magicIdLength = strlen(WriterImpl::magicId); |
| 470 | { |
| 471 | SCOPED_STOPWATCH(options_.getWriterMetrics(), IOBlockingLatencyUs, IOCount); |
| 472 | outStream_->write(WriterImpl::magicId, magicIdLength); |
| 473 | } |
| 474 | currentOffset_ += magicIdLength; |
| 475 | |
| 476 | // Initialize file footer |
| 477 | fileFooter_.set_header_length(currentOffset_); |
| 478 | fileFooter_.set_content_length(0); |
| 479 | fileFooter_.set_number_of_rows(0); |
| 480 | fileFooter_.set_row_index_stride(static_cast<uint32_t>(options_.getRowIndexStride())); |
| 481 | fileFooter_.set_writer(writerId); |
| 482 | fileFooter_.set_software_version(ORC_VERSION); |
| 483 | |
| 484 | uint32_t index = 0; |
| 485 | buildFooterType(type_, fileFooter_, index); |
| 486 | |
| 487 | // Initialize post script |
| 488 | postScript_.set_footer_length(0); |
| 489 | postScript_.set_compression(WriterImpl::convertCompressionKind(options_.getCompression())); |
| 490 | postScript_.set_compression_block_size(options_.getCompressionBlockSize()); |
| 491 | |
| 492 | postScript_.add_version(options_.getFileVersion().getMajor()); |
| 493 | postScript_.add_version(options_.getFileVersion().getMinor()); |
| 494 | |
| 495 | postScript_.set_writer_version(WriterVersion_ORC_135); |
| 496 | postScript_.set_magic("ORC"); |
| 497 | |
| 498 | // Initialize first stripe |
| 499 | initStripe(); |
| 500 | } |
| 501 | |
| 502 | void WriterImpl::initStripe() { |
| 503 | stripeInfo_.set_offset(currentOffset_); |
nothing calls this directly
no test coverage detected