34namespace Experimental {
46 std::unique_ptr<ROOT::Experimental::Detail::RFieldBase>
CloneImpl(std::string_view )
const final
48 return std::make_unique<RRDFCardinalityField>();
52 static std::string
TypeName() {
return "std::size_t"; }
60 void GenerateColumnsImpl() final { assert(
false &&
"Cardinality fields must only be used for reading"); }
65 fColumns.emplace_back(std::unique_ptr<ROOT::Experimental::Detail::RColumn>(
66 ROOT::Experimental::Detail::RColumn::Create<ClusterSize_t, EColumnType::kIndex>(model, 0)));
87 *value->Get<std::size_t>() =
size;
97 *value->Get<std::size_t>() =
size;
119 std::unique_ptr<RNTupleColumnReader>
Clone()
121 return std::make_unique<RNTupleColumnReader>(
fField->Clone(
fField->GetName()));
127 fField->ConnectPageSource(source);
129 f.ConnectPageSource(source);
147 std::vector<DescriptorId_t> skeinIDs)
188 skeinIDs.emplace_back(fieldId);
190 if (fieldDesc.GetTypeName().empty()) {
192 auto cardinalityField = std::make_unique<ROOT::Experimental::Internal::RRDFCardinalityField>();
193 cardinalityField->SetOnDiskId(fieldId);
194 fColumnNames.emplace_back(
"R_rdf_sizeof_" + std::string(colName));
196 auto cardColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(
197 std::move(cardinalityField));
201 AddField(desc, std::string(colName) +
"." +
f.GetFieldName(),
f.GetId(), skeinIDs);
206 AddField(desc, colName,
f.GetId(), skeinIDs);
214 auto innerName = colName.empty() ?
f.GetFieldName() : (std::string(colName) +
"." +
f.GetFieldName());
215 AddField(desc, innerName,
f.GetId(), skeinIDs);
222 if (!fieldOrException)
224 auto valueField = fieldOrException.Unwrap();
225 valueField->SetOnDiskId(fieldId);
226 std::unique_ptr<Detail::RFieldBase> cardinalityField;
228 if (!skeinIDs.empty()) {
229 cardinalityField = std::make_unique<ROOT::Experimental::Internal::RRDFCardinalityField>();
230 cardinalityField->SetOnDiskId(skeinIDs.back());
233 for (
auto i = skeinIDs.rbegin(); i != skeinIDs.rend(); ++i) {
234 valueField = std::make_unique<ROOT::Experimental::RVectorField>(
"", std::move(valueField));
235 valueField->SetOnDiskId(*i);
237 if (i != skeinIDs.rbegin()) {
238 cardinalityField = std::make_unique<ROOT::Experimental::RVectorField>(
"", std::move(cardinalityField));
239 cardinalityField->SetOnDiskId(*i);
243 if (cardinalityField) {
244 fColumnNames.emplace_back(
"R_rdf_sizeof_" + std::string(colName));
246 auto cardColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(
247 std::move(cardinalityField));
251 skeinIDs.emplace_back(fieldId);
254 auto valColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(std::move(valueField));
260 pageSource->Attach();
261 const auto &descriptor = pageSource->GetDescriptor();
262 fSources.emplace_back(std::move(pageSource));
264 AddField(descriptor,
"", descriptor.GetFieldZeroId(), std::vector<DescriptorId_t>());
273std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
292 std::vector<std::pair<ULong64_t, ULong64_t>> ranges;
296 auto nEntries =
fSources[0]->GetNEntries();
297 const auto chunkSize = nEntries /
fNSlots;
304 ranges.emplace_back(start, end);
307 ranges.back().second += reminder;
336 for (
unsigned int i = 1; i <
fNSlots; ++i) {
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long long ULong64_t
void GetCollectionInfo(const NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &typeName)
Factory method to resurrect a field from the stored on-disk type information.
std::vector< std::unique_ptr< RColumn > > fColumns
The columns are connected either to a sink or to a source (not to both); they are owned by the field.
RColumn * fPrincipalColumn
Points into fColumns.
Abstract interface to read data from an ntuple.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const RNTupleReadOptions &options=RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Every RDF column is represented by exactly one RNTuple field.
std::unique_ptr< RFieldBase > fField
The field backing the RDF column.
Long64_t fLastEntry
Last entry number that was read.
std::unique_ptr< RNTupleColumnReader > Clone()
Column readers are created as prototype and then cloned for every slot.
RNTupleColumnReader(std::unique_ptr< RFieldBase > f)
void * GetImpl(Long64_t entry) final
virtual ~RNTupleColumnReader()
RFieldValue fValue
The memory location used to read from fField.
void Connect(RPageSource &source)
Connect the field and its subfields to the page source.
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
ROOT::Experimental::Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
void GenerateColumnsImpl(const RNTupleDescriptor &) final
Creates the backing columns corresponsing to the field type for reading.
RRDFCardinalityField(RRDFCardinalityField &&other)=default
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
void ReadGlobalImpl(ROOT::Experimental::NTupleSize_t globalIndex, ROOT::Experimental::Detail::RFieldValue *value) final
Get the number of elements of the collection identified by globalIndex.
static std::string TypeName()
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
RRDFCardinalityField & operator=(RRDFCardinalityField &&other)=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ReadInClusterImpl(const ROOT::Experimental::RClusterIndex &clusterIndex, ROOT::Experimental::Detail::RFieldValue *value) final
Get the number of elements of the collection identified by clusterIndex.
std::unique_ptr< ROOT::Experimental::Detail::RFieldBase > CloneImpl(std::string_view) const final
Called by Clone(), which additionally copies the on-disk ID.
~RRDFCardinalityField()=default
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Holds the static meta-data of a column in a tree.
A field translates read and write calls from/to underlying columns to/from tree values.
std::unique_ptr< ROOT::Detail::RDF::RColumnReaderBase > GetColumnReaders(unsigned int, std::string_view, const std::type_info &) final
If the other GetColumnReaders overload returns an empty vector, this overload will be called instead.
void AddField(const RNTupleDescriptor &desc, std::string_view colName, DescriptorId_t fieldId, std::vector< DescriptorId_t > skeinIDs)
Provides the RDF column "colName" given the field identified by fieldID.
void SetNSlots(unsigned int nSlots) final
Inform RDataSource of the number of processing slots (i.e.
bool SetEntry(unsigned int slot, ULong64_t entry) final
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
std::vector< std::unique_ptr< ROOT::Experimental::Internal::RNTupleColumnReader > > fColumnReaderPrototypes
We prepare a column reader prototype for every column.
std::vector< std::unique_ptr< ROOT::Experimental::Detail::RPageSource > > fSources
Clones of the first source, one for each slot.
Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &) final
type-erased vector of pointers to pointers to column values - one per slot
std::vector< std::string > fColumnNames
std::string GetTypeName(std::string_view colName) const final
Type of a column as a string, e.g.
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges() final
Return ranges of entries to distribute to tasks.
RNTupleDS(std::unique_ptr< ROOT::Experimental::Detail::RPageSource > pageSource)
bool HasColumn(std::string_view colName) const final
Checks if the dataset has a certain column.
void Finalise() final
Convenience method called after concluding an event-loop.
std::vector< std::string > fColumnTypes
void Initialise() final
Convenience method called before starting an event-loop.
The on-storage meta-data of an ntuple.
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
std::vector< void * > Record_t
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTree,...
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
RDataFrame MakeNTupleDataFrame(std::string_view ntupleName, std::string_view fileName)
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TSeq< unsigned int > TSeqU
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...