31 auto dir = std::get<TDirectory *>(
fStorage);
36std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
42std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
58std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
68std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
88std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
102 return std::unique_ptr<RNTupleJoinProcessor>(
118 std::shared_ptr<ROOT::Experimental::Internal::RNTupleProcessorEntry>
entry)
125 fEntry = std::make_shared<Internal::RNTupleProcessorEntry>();
129 fPageSource = fNTupleSpec.CreatePageSource();
130 fPageSource->Attach();
132 fNEntries = fPageSource->GetNEntries();
138 auto desc = fPageSource->GetSharedDescriptorGuard();
145std::unique_ptr<ROOT::RFieldBase>
147 const std::string &typeName)
158 const auto &desc = fPageSource->GetSharedDescriptorGuard().GetRef();
168 std::unique_ptr<ROOT::RFieldBase>
field;
169 if (typeName.empty()) {
176 if (
posDot != std::string::npos)
185 return std::move(
fieldZero.ReleaseSubfields()[0]);
205 "\" because it is not present in the on-disk information of the RNTuple(s) this "
206 "processor is created from"));
224 fNEntriesProcessed++;
230 const std::unordered_set<ROOT::Experimental::Internal::RNTupleProcessorEntry::FieldIndex_t> &
fieldIdxs,
238 for (
const auto &
fieldIdx : fFieldIdxs) {
256 static constexpr int width = 32;
262 output <<
"+" << std::setfill(
'-') << std::setw(
width - 1) <<
"+\n";
265 if (
const std::string *
storage = std::get_if<std::string>(&fNTupleSpec.fStorage)) {
272 output <<
"| " << std::setw(
width - 2) <<
" |\n";
275 output <<
"+" << std::setfill(
'-') << std::setw(
width - 1) <<
"+\n";
293 std::shared_ptr<ROOT::Experimental::Internal::RNTupleProcessorEntry>
entry)
299 fEntry = std::make_shared<Internal::RNTupleProcessorEntry>();
303 fInnerProcessors[0]->Initialize(fEntry);
311 for (
unsigned i = 0; i < fInnerProcessors.size(); ++i) {
313 fInnerNEntries[i] = fInnerProcessors[i]->GetNEntries();
316 fNEntries += fInnerNEntries[i];
324 const std::unordered_set<ROOT::Experimental::Internal::RNTupleProcessorEntry::FieldIndex_t> &
fieldIdxs,
330 ConnectInnerProcessor(fCurrentProcessorNumber);
337 innerProc->Connect(fFieldIdxs, fProvenance,
true);
353 fCurrentProcessorNumber = 0;
354 ConnectInnerProcessor(fCurrentProcessorNumber);
374 fNEntriesProcessed++;
382 for (
unsigned i = 0; i < fInnerProcessors.size(); ++i) {
383 const auto &
innerProc = fInnerProcessors[i];
394 for (
const auto &
innerProc : fInnerProcessors) {
416 std::shared_ptr<ROOT::Experimental::Internal::RNTupleProcessorEntry>
entry)
422 fEntry = std::make_shared<Internal::RNTupleProcessorEntry>();
426 fPrimaryProcessor->Initialize(fEntry);
427 fAuxiliaryProcessor->Initialize(fEntry);
429 if (!fJoinFieldNames.empty()) {
430 for (
const auto &
joinField : fJoinFieldNames) {
431 if (!fPrimaryProcessor->CanReadFieldFromDisk(
joinField)) {
433 fPrimaryProcessor->GetProcessorName() +
"\""));
435 if (!fAuxiliaryProcessor->CanReadFieldFromDisk(
joinField)) {
437 fAuxiliaryProcessor->GetProcessorName() +
"\""));
442 auto fieldIdx = AddFieldToEntry(fProcessorName +
"._join." +
joinField,
"std::uint64_t",
nullptr,
452 const std::unordered_set<ROOT::Experimental::Internal::RNTupleProcessorEntry::FieldIndex_t> &
fieldIdxs,
461 fAuxiliaryFieldIdxs.insert(
fieldIdx);
480 if (fPrimaryProcessor->CanReadFieldFromDisk(
fieldName)) {
482 "\" is present in the primary RNTupleProcessor \"" +
483 fPrimaryProcessor->GetProcessorName() +
484 "\", but may also refer to a field in the auxiliary RNTupleProcessor named \"" +
485 fAuxiliaryProcessor->GetProcessorName() +
486 "\". To avoid this ambiguity, rename the auxiliary RNTupleProcessor."));
491 fAuxiliaryFieldIdxs.insert(
fieldIdx);
503 for (
const auto &
fieldIdx : fAuxiliaryFieldIdxs) {
504 fEntry->SetFieldValidity(
fieldIdx, isValid);
512 fEntry->SetFieldValidity(
fieldIdx,
false);
514 SetAuxiliaryFieldValidity(
false);
519 fNEntriesProcessed++;
527 if (!fJoinTableIsBuilt) {
528 fAuxiliaryProcessor->AddEntriesToJoinTable(*fJoinTable);
529 fJoinTableIsBuilt =
true;
533 std::vector<ROOT::Experimental::Internal::RNTupleJoinTable::JoinValue_t> values;
534 values.reserve(fJoinFieldIdxs.size());
535 for (
const auto &
fieldIdx : fJoinFieldIdxs) {
537 values.push_back(val);
542 const auto entryIdx = fJoinTable->GetEntryIndex(values);
545 SetAuxiliaryFieldValidity(
false);
547 SetAuxiliaryFieldValidity(
true);
548 for (
const auto &
fieldIdx : fAuxiliaryFieldIdxs) {
559 fNEntries = fPrimaryProcessor->GetNEntries();
581 for (
unsigned i = 0; i <
maxLength; i++) {
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Builds a join table on one or several fields of an RNTuple so it can be joined onto other RNTuples.
static std::unique_ptr< RNTupleJoinTable > Create(const std::vector< std::string > &joinFieldNames)
Create an RNTupleJoinTable from an existing RNTuple.
std::uint64_t JoinValue_t
static constexpr PartitionKey_t kDefaultPartitionKey
std::uint64_t FieldIndex_t
Processor specialization for vertically combined (chained) RNTupleProcessors.
void PrintStructureImpl(std::ostream &output) const final
Processor-specific implementation for printing its structure, called by PrintStructure().
void AddEntriesToJoinTable(Internal::RNTupleJoinTable &joinTable, ROOT::NTupleSize_t entryOffset=0) final
Add the entry mappings for this processor to the provided join table.
void ConnectInnerProcessor(std::size_t processorNumber)
Update the entry to reflect any missing fields in the current inner processor.
Internal::RNTupleProcessorEntry::FieldIndex_t AddFieldToEntry(const std::string &fieldName, const std::string &typeName, void *valuePtr=nullptr, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance()) final
Add a field to the entry.
ROOT::NTupleSize_t GetNEntries() final
Get the total number of entries in this processor.
void Initialize(std::shared_ptr< Internal::RNTupleProcessorEntry > entry=nullptr) final
Initialize the processor by creating an (initially empty) fEntry, or setting an existing one.
std::vector< ROOT::NTupleSize_t > fInnerNEntries
void Connect(const std::unordered_set< Internal::RNTupleProcessorEntry::FieldIndex_t > &fieldIdxs, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance(), bool updateFields=false) final
Connect the provided fields indices in the entry to their on-disk fields.
ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber) final
Load the entry identified by the provided (global) entry number (i.e., considering all RNTuples in th...
std::vector< std::unique_ptr< RNTupleProcessor > > fInnerProcessors
Processor specialization for horizontally combined (joined) RNTupleProcessors.
void PrintStructureImpl(std::ostream &output) const final
Processor-specific implementation for printing its structure, called by PrintStructure().
ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber) final
Load the entry identified by the provided entry number of the primary processor.
void AddEntriesToJoinTable(Internal::RNTupleJoinTable &joinTable, ROOT::NTupleSize_t entryOffset=0) final
Add the entry mappings for this processor to the provided join table.
ROOT::NTupleSize_t GetNEntries() final
Get the total number of entries in this processor.
void SetAuxiliaryFieldValidity(bool validity)
Set the validity for all fields in the auxiliary processor at once.
void Connect(const std::unordered_set< Internal::RNTupleProcessorEntry::FieldIndex_t > &fieldIdxs, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance(), bool updateFields=false) final
Connect the provided fields indices in the entry to their on-disk fields.
std::unique_ptr< RNTupleProcessor > fPrimaryProcessor
void Initialize(std::shared_ptr< Internal::RNTupleProcessorEntry > entry=nullptr) final
Initialize the processor by creating an (initially empty) fEntry, or setting an existing one.
Internal::RNTupleProcessorEntry::FieldIndex_t AddFieldToEntry(const std::string &fieldName, const std::string &typeName, void *valuePtr=nullptr, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance()) final
Add a field to the entry.
Specification of the name and location of an RNTuple, used for creating a new RNTupleProcessor.
std::variant< std::string, TDirectory * > fStorage
std::unique_ptr< ROOT::Internal::RPageSource > CreatePageSource() const
Interface for iterating over entries of vertically ("chained") and/or horizontally ("joined") combine...
static std::unique_ptr< RNTupleProcessor > CreateJoin(RNTupleOpenSpec primaryNTuple, RNTupleOpenSpec auxNTuple, const std::vector< std::string > &joinFields, std::string_view processorName="")
Create an RNTupleProcessor for a join (i.e., a horizontal combination) of RNTuples.
friend class RNTupleJoinProcessor
static std::unique_ptr< RNTupleProcessor > CreateChain(std::vector< RNTupleOpenSpec > ntuples, std::string_view processorName="")
Create an RNTupleProcessor for a chain (i.e., a vertical combination) of RNTuples.
std::string fProcessorName
friend class RNTupleChainProcessor
friend class RNTupleSingleProcessor
static std::unique_ptr< RNTupleProcessor > Create(RNTupleOpenSpec ntuple, std::string_view processorName="")
Create an RNTupleProcessor for a single RNTuple.
Processor specialization for processing a single RNTuple.
void AddEntriesToJoinTable(Internal::RNTupleJoinTable &joinTable, ROOT::NTupleSize_t entryOffset=0) final
Add the entry mappings for this processor to the provided join table.
void Connect(const std::unordered_set< Internal::RNTupleProcessorEntry::FieldIndex_t > &fieldIdxs, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance(), bool updateFields=false) final
Connect the provided fields indices in the entry to their on-disk fields.
void Initialize(std::shared_ptr< Internal::RNTupleProcessorEntry > entry=nullptr) final
Initialize the processor by creating an (initially empty) fEntry, or setting an existing one.
void PrintStructureImpl(std::ostream &output) const final
Processor-specific implementation for printing its structure, called by PrintStructure().
RNTupleOpenSpec fNTupleSpec
bool CanReadFieldFromDisk(std::string_view fieldName) final
Check if a field exists on-disk and can be read by the processor.
ROOT::NTupleSize_t LoadEntry(ROOT::NTupleSize_t entryNumber) final
Load the entry identified by the provided (global) entry number (i.e., considering all RNTuples in th...
Internal::RNTupleProcessorEntry::FieldIndex_t AddFieldToEntry(const std::string &fieldName, const std::string &typeName, void *valuePtr=nullptr, const Internal::RNTupleProcessorProvenance &provenance=Internal::RNTupleProcessorProvenance()) final
Add a field to the entry.
std::unique_ptr< ROOT::RFieldBase > CreateAndConnectField(const std::string &qualifiedFieldName, const std::string &typeName)
Create a new field and connect it to the processor's page source.
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Used from the RNTuple class to build a datasource if the anchor is already available.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Base class for all ROOT issued exceptions.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &typeName, const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
Factory method to resurrect a field from the stored on-disk type information.
The container field for an ntuple model, which itself has no physical representation.
Representation of an RNTuple data set in a ROOT file.
const_iterator begin() const
const_iterator end() const
void SetAllowFieldSubstitutions(RFieldZero &fieldZero, bool val)
void CallConnectPageSourceOnField(RFieldBase &, ROOT::Internal::RPageSource &)
constexpr NTupleSize_t kInvalidNTupleIndex
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId