41namespace Experimental {
83 void AddTask(const std::function<
void(
void)> &taskFunc) final;
114 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fUnzipTasks;
133 void InitPageSource();
167 ROpenSpec(std::string_view
n, std::string_view s) : fNTupleName(
n), fStorage(s) {}
171 static std::unique_ptr<RNTupleReader> Open(std::unique_ptr<RNTupleModel> model,
172 std::string_view ntupleName,
173 std::string_view storage,
189 static std::unique_ptr<RNTupleReader> Open(std::string_view ntupleName,
190 std::string_view storage,
192 static std::unique_ptr<RNTupleReader>
197 static std::unique_ptr<RNTupleReader> OpenFriends(std::span<ROpenSpec> ntuples);
203 RNTupleReader(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSource> source);
207 explicit RNTupleReader(std::unique_ptr<Detail::RPageSource> source);
208 std::unique_ptr<RNTupleReader>
Clone() {
return std::make_unique<RNTupleReader>(fSource->Clone()); }
252 std::ostream &
output = std::cout);
259 fModel = fSource->GetSharedDescriptorGuard()->GenerateModel();
260 ConnectModel(*fModel);
262 LoadEntry(
index, *fModel->GetDefaultEntry());
266 for (
auto&
value : entry) {
308 template <
typename T>
310 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
312 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
313 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
322 auto fieldId = fSource->GetSharedDescriptorGuard()->FindFieldId(fieldName);
324 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
325 fSource->GetSharedDescriptorGuard()->GetName() +
"'"));
372 std::unique_ptr<Detail::RPageStorage::RTaskScheduler>
fZipTasks;
373 std::unique_ptr<Detail::RPageSink>
fSink;
381 std::size_t fUnzippedClusterSize = 0;
383 std::uint64_t fNBytesCommitted = 0;
386 std::uint64_t fNBytesFilled = 0;
393 void CommitClusterGroup();
397 static std::unique_ptr<RNTupleWriter> Recreate(std::unique_ptr<RNTupleModel> model,
398 std::string_view ntupleName,
399 std::string_view storage,
402 static std::unique_ptr<RNTupleWriter> Append(std::unique_ptr<RNTupleModel> model,
403 std::string_view ntupleName,
407 RNTupleWriter(std::unique_ptr<RNTupleModel> model, std::unique_ptr<Detail::RPageSink> sink);
414 std::size_t
Fill() {
return Fill(*fModel->GetDefaultEntry()); }
422 std::size_t bytesWritten = 0;
423 for (
auto&
value : entry) {
424 bytesWritten +=
value.GetField()->Append(
value);
426 fUnzippedClusterSize += bytesWritten;
428 if ((fUnzippedClusterSize >= fMaxUnzippedClusterSize) || (fUnzippedClusterSize >= fUnzippedClusterSizeEst))
433 void CommitCluster(
bool commitClusterGroup =
false);
435 std::unique_ptr<REntry>
CreateEntry() {
return fModel->CreateEntry(); }
466 for (
auto &
value : *entry) {
498 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
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
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.
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.
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 a suite of consecutive data records (TKey instances) with a well defined format.
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
ENTupleShowFormat
Listing of the different entry output formats of RNTupleReader::Show()
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 32bit 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)