| 354 | } |
| 355 | |
| 356 | uint64_t SpillWriter::writeAndFlush( |
| 357 | const RowVectorPtr& rows, |
| 358 | const folly::Range<IndexRange*>& indices) { |
| 359 | checkNotFinished(); |
| 360 | |
| 361 | uint64_t timeUs{0}; |
| 362 | { |
| 363 | MicrosecondTimer timer(&timeUs); |
| 364 | if (batch_ == nullptr) { |
| 365 | bytedance::bolt::VectorSerde::Options options = { |
| 366 | kDefaultUseLosslessTimestamp, compressionKind_}; |
| 367 | batch_ = std::make_unique<VectorStreamGroup>(pool_, serde_); |
| 368 | batch_->createStreamTree( |
| 369 | std::static_pointer_cast<const RowType>(rows->type()), |
| 370 | rows->size(), |
| 371 | &options); |
| 372 | } |
| 373 | batch_->append(rows, indices); |
| 374 | } |
| 375 | rowsInCurrentFile_ += rows->size(); |
| 376 | updateAppendStats(rows->size(), timeUs); |
| 377 | return flush(); |
| 378 | } |
| 379 | |
| 380 | uint64_t SpillWriter::write( |
| 381 | const std::vector<char*, memory::StlAllocator<char*>>& rows, |
no test coverage detected