| 75 | } |
| 76 | |
| 77 | void OperatorTraceInputWriter::write(const RowVectorPtr& rows) { |
| 78 | if (FOLLY_UNLIKELY(finished_)) { |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (batch_ == nullptr) { |
| 83 | batch_ = std::make_unique<VectorStreamGroup>(pool_, serde_); |
| 84 | batch_->createStreamTree( |
| 85 | std::static_pointer_cast<const RowType>(rows->type()), |
| 86 | 1'000, |
| 87 | &options_); |
| 88 | } |
| 89 | batch_->append(rows); |
| 90 | |
| 91 | // Serialize and write out each batch. |
| 92 | IOBufOutputStream out( |
| 93 | *pool_, nullptr, std::max<int64_t>(64 * 1024, batch_->size())); |
| 94 | batch_->flush(&out); |
| 95 | batch_->clear(); |
| 96 | auto iobuf = out.getIOBuf(); |
| 97 | updateAndCheckTraceLimitCB_(iobuf->computeChainDataLength()); |
| 98 | traceFile_->append(std::move(iobuf)); |
| 99 | } |
| 100 | |
| 101 | void OperatorTraceInputWriter::finish() { |
| 102 | if (finished_) { |
nothing calls this directly
no test coverage detected