| 365 | const WriterId WriterImpl::writerId = WriterId::ORC_CPP_WRITER; |
| 366 | |
| 367 | WriterImpl::WriterImpl(const Type& t, OutputStream* stream, const WriterOptions& opts) |
| 368 | : outStream_(stream), options_(opts), type_(t) { |
| 369 | streamsFactory_ = createStreamsFactory(options_, outStream_); |
| 370 | columnWriter_ = buildWriter(type_, *streamsFactory_, options_); |
| 371 | stripeRows_ = totalRows_ = indexRows_ = 0; |
| 372 | currentOffset_ = 0; |
| 373 | stripesAtLastFlush_ = 0; |
| 374 | lastFlushOffset_ = 0; |
| 375 | |
| 376 | useTightNumericVector_ = opts.getUseTightNumericVector(); |
| 377 | |
| 378 | if (options_.getCompressionBlockSize() % options_.getMemoryBlockSize() != 0) { |
| 379 | throw std::invalid_argument( |
| 380 | "Compression block size must be a multiple of memory block size."); |
| 381 | } |
| 382 | |
| 383 | // compression stream for stripe footer, file footer and metadata |
| 384 | compressionStream_ = createCompressor( |
| 385 | options_.getCompression(), outStream_, options_.getCompressionStrategy(), |
| 386 | options_.getOutputBufferCapacity(), options_.getCompressionBlockSize(), |
| 387 | options_.getMemoryBlockSize(), *options_.getMemoryPool(), options_.getWriterMetrics()); |
| 388 | |
| 389 | // uncompressed stream for post script |
| 390 | bufferedStream_.reset(new BufferedOutputStream(*options_.getMemoryPool(), outStream_, |
| 391 | 1024, // buffer capacity: 1024 bytes |
| 392 | options_.getCompressionBlockSize(), |
| 393 | options_.getWriterMetrics())); |
| 394 | |
| 395 | init(); |
| 396 | } |
| 397 | |
| 398 | std::unique_ptr<ColumnVectorBatch> WriterImpl::createRowBatch(uint64_t size) const { |
| 399 | return type_.createRowBatch(size, *options_.getMemoryPool(), false, useTightNumericVector_); |
nothing calls this directly
no test coverage detected