42namespace Experimental {
75 void AddTask(const std::function<
void(
void)> &taskFunc) final;
106 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fUnzipTasks;
125 void InitPageSource();
159 ROpenSpec(std::string_view
n, std::string_view s) : fNTupleName(
n), fStorage(s) {}
163 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
164 std::string_view ntupleName,
165 std::string_view storage,
181 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
182 std::string_view storage,
184 static std::unique_ptr<RNTupleReader>
189 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
195 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
199 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
200 std::unique_ptr<RNTupleReader>
Clone() {
return std::make_unique<RNTupleReader>(fSource->Clone()); }
250 fModel = fSource->GetSharedDescriptorGuard()->GenerateModel();
251 ConnectModel(*fModel);
253 LoadEntry(
index, *fModel->GetDefaultEntry());
257 for (
auto&
value : entry) {
299 template <
typename T>
301 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
303 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
304 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
313 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
315 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
316 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
365 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fZipTasks;
366 std::unique_ptr<Detail::RPageSink>
fSink;
374 std::size_t fUnzippedClusterSize = 0;
376 std::uint64_t fNBytesCommitted = 0;
379 std::uint64_t fNBytesFilled = 0;
386 void CommitClusterGroup();
390 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
391 std::string_view ntupleName,
392 std::string_view storage,
395 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
396 std::string_view ntupleName,
400 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
407 std::size_t
Fill() {
return Fill(*fModel->GetDefaultEntry()); }
415 std::size_t bytesWritten = 0;
416 for (
auto&
value : entry) {
417 bytesWritten +=
value.Append();
419 fUnzippedClusterSize += bytesWritten;
421 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
426 void CommitCluster(
bool commitClusterGroup =
false);
428 std::unique_ptr<REntry>
CreateEntry() {
return fModel->CreateEntry(); }
463 return std::make_unique<RNTupleModel::RUpdater>(*
this);
490 for (
auto &
value : *entry) {
522 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.
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
NTupleSize_t GetLastCommittedClusterGroup() const
Return the entry number that was last committed in a cluster group.
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()
NTupleSize_t GetLastCommitted() const
Return the entry number that was last committed in a cluster.
std::size_t fUnzippedClusterSizeEst
Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
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
NTupleSize_t GetNEntries() const
Return the number of entries filled so far.
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)