28 std::unique_ptr<ROOT::Internal::RPageSink> sink)
29 : fSink(std::move(sink)), fModel(std::move(model)), fMetrics(
"RNTupleFillContext")
35 const auto &writeOpts =
fSink->GetWriteOptions();
38 const int scale = writeOpts.GetCompression() ? 2 : 1;
65 if (fNEntries == fLastFlushed) {
71 auto nEntriesInCluster = fNEntries - fLastFlushed;
72 if (fStagedClusterCommitting) {
73 auto stagedCluster = fSink->StageCluster(nEntriesInCluster);
74 fNBytesFlushed += stagedCluster.fNBytesWritten;
75 fStagedClusters.push_back(std::move(stagedCluster));
77 fNBytesFlushed += fSink->CommitCluster(nEntriesInCluster);
79 fNBytesFilled += fUnzippedClusterSize;
82 const float compressionFactor =
83 std::min(1000.f,
static_cast<float>(fNBytesFilled) /
static_cast<float>(fNBytesFlushed));
84 fUnzippedClusterSizeEst =
85 compressionFactor *
static_cast<float>(fSink->GetWriteOptions().GetApproxZippedClusterSize());
87 fLastFlushed = fNEntries;
88 fUnzippedClusterSize = 0;
void FlushCluster()
Flush so far filled entries to storage.
std::size_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
Experimental::Detail::RNTupleMetrics fMetrics
void FlushColumns()
Flush column data, preparing for CommitCluster or to reduce memory usage.
RNTupleFillContext(std::unique_ptr< ROOT::RNTupleModel > model, std::unique_ptr< ROOT::Internal::RPageSink > sink)
void CommitStagedClusters()
Logically append staged clusters to the RNTuple.
std::unique_ptr< ROOT::RNTupleModel > fModel
Needs to be destructed before fSink.
std::unique_ptr< ROOT::Internal::RPageSink > fSink
std::size_t fMaxUnzippedClusterSize
Limit for committing cluster no matter the other tunables.