Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Internal::RNTupleIndex Class Reference

Builds an index on one or several fields of an RNTuple so it can be joined onto other RNTuples.

Definition at line 36 of file RNTupleIndex.hxx.

Classes

class  RIndexValue
 Container for the hashes of the indexed fields. More...
 
struct  RIndexValueHash
 Hash combinining the individual index value hashes from RIndexValue. More...
 

Public Types

using NTupleIndexValue_t = std::uint64_t
 

Public Member Functions

 RNTupleIndex (const RNTupleIndex &other)=delete
 
 RNTupleIndex (RNTupleIndex &&other)=delete
 
 ~RNTupleIndex ()=default
 
void Build ()
 Build the index.
 
const std::vector< NTupleSize_t > * GetAllEntryNumbers (const std::vector< void * > &valuePtrs) const
 Get all entry numbers for the given index.
 
template<typename... Ts>
const std::vector< NTupleSize_t > * GetAllEntryNumbers (Ts... values) const
 Get all entry numbers for the given index.
 
NTupleSize_t GetFirstEntryNumber (const std::vector< void * > &valuePtrs) const
 Get the first entry number containing the given index value.
 
template<typename... Ts>
NTupleSize_t GetFirstEntryNumber (Ts... values) const
 Get the entry number containing the given index value.
 
std::size_t GetSize () const
 Get the number of indexed values.
 
bool IsBuilt () const
 Whether the index has been built (and therefore ready to be used).
 
RNTupleIndexoperator= (const RNTupleIndex &other)=delete
 
RNTupleIndexoperator= (RNTupleIndex &&other)=delete
 

Static Public Member Functions

static std::unique_ptr< RNTupleIndexCreate (const std::vector< std::string > &fieldNames, const RPageSource &pageSource, bool deferBuild=false)
 Create an RNTupleIndex from an existing RNTuple.
 

Private Member Functions

 RNTupleIndex (const std::vector< std::string > &fieldNames, const RPageSource &pageSource)
 Create an a new RNTupleIndex for the RNTuple represented by the provided page source.
 
void EnsureBuilt () const
 Ensure the RNTupleIndex has been built.
 

Private Attributes

std::unordered_map< RIndexValue, std::vector< NTupleSize_t >, RIndexValueHashfIndex
 The index itself.
 
std::vector< std::unique_ptr< RFieldBase > > fIndexFields
 The fields for which the index is built. Used to compute the hashes for each entry value.
 
bool fIsBuilt = false
 Only built indexes can be queried.
 
std::unique_ptr< RPageSourcefPageSource
 The page source belonging to the RNTuple for which to build the index.
 

#include <ROOT/RNTupleIndex.hxx>

Member Typedef Documentation

◆ NTupleIndexValue_t

Definition at line 38 of file RNTupleIndex.hxx.

Constructor & Destructor Documentation

◆ RNTupleIndex() [1/3]

ROOT::Experimental::Internal::RNTupleIndex::RNTupleIndex ( const std::vector< std::string > &  fieldNames,
const RPageSource pageSource 
)
private

Create an a new RNTupleIndex for the RNTuple represented by the provided page source.

Parameters
[in]fieldNamesThe names of the fields to index. Only integral-type fields can be specified as index fields.
[in]pageSourceThe page source.

Definition at line 36 of file RNTupleIndex.cxx.

◆ RNTupleIndex() [2/3]

ROOT::Experimental::Internal::RNTupleIndex::RNTupleIndex ( const RNTupleIndex other)
delete

◆ RNTupleIndex() [3/3]

ROOT::Experimental::Internal::RNTupleIndex::RNTupleIndex ( RNTupleIndex &&  other)
delete

◆ ~RNTupleIndex()

ROOT::Experimental::Internal::RNTupleIndex::~RNTupleIndex ( )
default

Member Function Documentation

◆ Build()

void ROOT::Experimental::Internal::RNTupleIndex::Build ( )

Build the index.

Only a built index can be queried (with RNTupleIndex::GetFirstEntryNumber or RNTupleIndex::GetAllEntryNumbers).

Definition at line 78 of file RNTupleIndex.cxx.

◆ Create()

std::unique_ptr< ROOT::Experimental::Internal::RNTupleIndex > ROOT::Experimental::Internal::RNTupleIndex::Create ( const std::vector< std::string > &  fieldNames,
const RPageSource pageSource,
bool  deferBuild = false 
)
static

Create an RNTupleIndex from an existing RNTuple.

Parameters
[in]fieldNamesThe names of the fields to index. Only integral-type fields can be specified as index fields.
[in]pageSourceThe page source.
[in]deferBuildWhen set to true, an empty index will be created. A call to RNTupleIndex::Build is required before the index can actually be used.
Returns
A pointer to the newly-created index.

Definition at line 67 of file RNTupleIndex.cxx.

◆ EnsureBuilt()

void ROOT::Experimental::Internal::RNTupleIndex::EnsureBuilt ( ) const
private

Ensure the RNTupleIndex has been built.

Exceptions
RExceptionIf the index has not been built, and can therefore not be used yet.

Definition at line 60 of file RNTupleIndex.cxx.

◆ GetAllEntryNumbers() [1/2]

const std::vector< ROOT::Experimental::NTupleSize_t > * ROOT::Experimental::Internal::RNTupleIndex::GetAllEntryNumbers ( const std::vector< void * > &  valuePtrs) const

Get all entry numbers for the given index.

Parameters
[in]valuePtrsA vector of pointers to the index values to look up.
Returns
The entry numbers that corresponds to valuePtrs. When no such entry exists, an empty vector is returned.

Definition at line 126 of file RNTupleIndex.cxx.

◆ GetAllEntryNumbers() [2/2]

template<typename... Ts>
const std::vector< NTupleSize_t > * ROOT::Experimental::Internal::RNTupleIndex::GetAllEntryNumbers ( Ts...  values) const
inline

Get all entry numbers for the given index.

See also
GetAllEntryNumbers(std::vector<void *> valuePtrs)

Definition at line 186 of file RNTupleIndex.hxx.

◆ GetFirstEntryNumber() [1/2]

ROOT::Experimental::NTupleSize_t ROOT::Experimental::Internal::RNTupleIndex::GetFirstEntryNumber ( const std::vector< void * > &  valuePtrs) const

Get the first entry number containing the given index value.

Parameters
[in]valuePtrsA vector of pointers to the index values to look up.
Returns
The first entry number that corresponds to valuePtrs. When no such entry exists, kInvalidNTupleIndex is returned.

Note that in case multiple entries corresponding to the provided index value exist, the first occurrence is returned. Use RNTupleIndex::GetAllEntryNumbers to get all entries.

Definition at line 117 of file RNTupleIndex.cxx.

◆ GetFirstEntryNumber() [2/2]

template<typename... Ts>
NTupleSize_t ROOT::Experimental::Internal::RNTupleIndex::GetFirstEntryNumber ( Ts...  values) const
inline

Get the entry number containing the given index value.

See also
GetFirstEntryNumber(std::vector<void *> valuePtrs)

Definition at line 160 of file RNTupleIndex.hxx.

◆ GetSize()

std::size_t ROOT::Experimental::Internal::RNTupleIndex::GetSize ( ) const
inline

Get the number of indexed values.

Returns
The number of indexed values.
Note
This does not have to correspond to the number of entries in the original RNTuple. If the original RNTuple contains duplicate index values, they are counted as one.

Definition at line 129 of file RNTupleIndex.hxx.

◆ IsBuilt()

bool ROOT::Experimental::Internal::RNTupleIndex::IsBuilt ( ) const
inline

Whether the index has been built (and therefore ready to be used).

Returns
true if the index has been built.

Only built indexes can be queried.

Definition at line 141 of file RNTupleIndex.hxx.

◆ operator=() [1/2]

RNTupleIndex & ROOT::Experimental::Internal::RNTupleIndex::operator= ( const RNTupleIndex other)
delete

◆ operator=() [2/2]

RNTupleIndex & ROOT::Experimental::Internal::RNTupleIndex::operator= ( RNTupleIndex &&  other)
delete

Member Data Documentation

◆ fIndex

std::unordered_map<RIndexValue, std::vector<NTupleSize_t>, RIndexValueHash> ROOT::Experimental::Internal::RNTupleIndex::fIndex
private

The index itself.

Maps field values (or combinations thereof in case the index is defined for multiple fields) to their respsective entry numbers.

Definition at line 71 of file RNTupleIndex.hxx.

◆ fIndexFields

std::vector<std::unique_ptr<RFieldBase> > ROOT::Experimental::Internal::RNTupleIndex::fIndexFields
private

The fields for which the index is built. Used to compute the hashes for each entry value.

Definition at line 77 of file RNTupleIndex.hxx.

◆ fIsBuilt

bool ROOT::Experimental::Internal::RNTupleIndex::fIsBuilt = false
private

Only built indexes can be queried.

Definition at line 80 of file RNTupleIndex.hxx.

◆ fPageSource

std::unique_ptr<RPageSource> ROOT::Experimental::Internal::RNTupleIndex::fPageSource
private

The page source belonging to the RNTuple for which to build the index.

Definition at line 74 of file RNTupleIndex.hxx.

Libraries for ROOT::Experimental::Internal::RNTupleIndex:

The documentation for this class was generated from the following files: