41namespace Experimental {
74 void AddTask(const std::function<
void(
void)> &taskFunc) final;
105 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fUnzipTasks;
124 void InitPageSource();
158 ROpenSpec(std::string_view
n, std::string_view s) : fNTupleName(
n), fStorage(s) {}
162 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
163 std::string_view ntupleName,
164 std::string_view storage,
180 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
181 std::string_view storage,
183 static std::unique_ptr<RNTupleReader>
188 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
194 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
198 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
199 std::unique_ptr<RNTupleReader>
Clone() {
return std::make_unique<RNTupleReader>(fSource->Clone()); }
249 fModel = fSource->GetSharedDescriptorGuard()->GenerateModel();
250 ConnectModel(*fModel);
252 LoadEntry(
index, *fModel->GetDefaultEntry());
256 for (
auto&
value : entry) {
298 template <
typename T>
300 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
302 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
303 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
312 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
314 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
315 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
364 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fZipTasks;
365 std::unique_ptr<Detail::RPageSink>
fSink;
373 std::size_t fUnzippedClusterSize = 0;
375 std::uint64_t fNBytesCommitted = 0;
378 std::uint64_t fNBytesFilled = 0;
385 void CommitClusterGroup();
389 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
390 std::string_view ntupleName,
391 std::string_view storage,
394 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
395 std::string_view ntupleName,
399 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
406 std::size_t
Fill() {
return Fill(*fModel->GetDefaultEntry()); }
414 std::size_t bytesWritten = 0;
415 for (
auto&
value : entry) {
416 bytesWritten +=
value.Append();
418 fUnzippedClusterSize += bytesWritten;
420 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
425 void CommitCluster(
bool commitClusterGroup =
false);
427 std::unique_ptr<REntry>
CreateEntry() {
return fModel->CreateEntry(); }
482 for (
auto &
value : *entry) {
514 friend struct ROOT::Experimental::Internal::RNTupleTester;
#define R__unlikely(expr)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define ClassDefNV(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
TTime operator*(const TTime &t1, const TTime &t2)
A collection of Counter objects with a name, a unit, and a description.
The interface of a task scheduler to schedule page (de)compression tasks.
Write RNTuple data blocks in a TFile or a bare file container.
RCollectionNTupleWriter(const RCollectionNTupleWriter &)=delete
ClusterSize_t * GetOffsetPtr()
~RCollectionNTupleWriter()=default
RCollectionNTupleWriter & operator=(const RCollectionNTupleWriter &)=delete
std::unique_ptr< REntry > fDefaultEntry
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
std::uint64_t GetModelId() const
Base class for all ROOT issued exceptions.
The on-storage meta-data of an ntuple.
Used to loop over indexes (entries or collections) between start and end.
void Reset() final
Start a new set of tasks.
~RNTupleImtTaskScheduler() override=default
std::unique_ptr< TTaskGroup > fTaskGroup
void AddTask(const std::function< void(void)> &taskFunc) final
Take a callable that represents a task.
RNTupleImtTaskScheduler()
void Wait() final
Blocks until all scheduled tasks finished.
A model is usually immutable after passing it to an RNTupleWriter.
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for reading ntuples.
NTupleSize_t difference_type
bool operator!=(const iterator &rh) const
bool operator==(const iterator &rh) const
RIterator(NTupleSize_t index)
std::forward_iterator_tag iterator_category
An RNTuple that is used to read data from storage.
std::unique_ptr< RNTupleReader > Clone()
Detail::RNTupleMetrics fMetrics
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fUnzipTasks
Set as the page source's scheduler for parallel page decompression if IMT is on Needs to be destructe...
std::unique_ptr< RNTupleReader > fDisplayReader
We use a dedicated on-demand reader for Show() and Scan().
void EnableMetrics()
Enable performance measurements (decompression time, bytes read from storage, etc....
const Detail::RNTupleMetrics & GetMetrics() const
RNTupleView< T > GetView(std::string_view fieldName)
Provides access to an individual field that can contain either a scalar value or a collection,...
NTupleSize_t GetNEntries() const
std::unique_ptr< RNTupleDescriptor > fCachedDescriptor
The ntuple descriptor in the page source is protected by a read-write lock.
std::unique_ptr< Detail::RPageSource > fSource
RNTupleGlobalRange GetEntryRange()
Returns an iterator over the entry indices of the RNTuple.
RNTupleViewCollection GetViewCollection(std::string_view fieldName)
Raises an exception if:
void LoadEntry(NTupleSize_t index)
Analogous to Fill(), fills the default entry of the model.
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSource.
void LoadEntry(NTupleSize_t index, REntry &entry)
Fills a user provided entry after checking that the entry has been instantiated from the ntuple model...
A view for a collection, that can itself generate new ntuple views for its nested fields.
An RNTupleView provides read-only access to a single field of the ntuple.
Common user-tunable settings for storing ntuples.
An RNTuple that gets filled with entries (data) and writes them to storage.
NTupleSize_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
std::size_t fMaxUnzippedClusterSize
Limit for committing cluster no matter the other tunables.
std::unique_ptr< RNTupleModel::RUpdater > CreateModelUpdater()
Get a RNTupleModel::RUpdater that provides limited support for incremental updates to the underlying ...
const Detail::RNTupleMetrics & GetMetrics() const
std::size_t Fill()
The simplest user interface if the default entry that comes with the ntuple model is used.
std::unique_ptr< REntry > CreateEntry()
std::unique_ptr< RNTupleModel > fModel
Needs to be destructed before fSink.
RNTupleWriter(const RNTupleWriter &)=delete
Detail::RNTupleMetrics fMetrics
std::size_t Fill(REntry &entry)
Multiple entries can have been instantiated from the ntuple model.
RNTupleWriter & operator=(const RNTupleWriter &)=delete
std::unique_ptr< Detail::RPageSink > fSink
const RNTupleModel * GetModel() const
std::unique_ptr< Detail::RPageStorage::RTaskScheduler > fZipTasks
The page sink's parallel page compression scheduler if IMT is on.
Representation of an RNTuple data set in a ROOT file.
Internal::RFileNTupleAnchor GetAnchor() const
RNTuple(const Internal::RFileNTupleAnchor &a)
Collection abstract base class.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
ENTupleInfo
Listing of the different options that can be printed by RNTupleReader::GetInfo()
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr NTupleSize_t kInvalidNTupleIndex
constexpr DescriptorId_t kInvalidDescriptorId
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Entry point for an RNTuple in a ROOT file.
Wrap the integer in a struct in order to avoid template specialization clash with std::uint32_t.
Used to specify the underlying RNTuples in OpenFriends()
RNTupleReadOptions fOptions
ROpenSpec(std::string_view n, std::string_view s)