15#ifndef ROOT_RNTupleMerger
16#define ROOT_RNTupleMerger
32class RNTupleAttrRange;
37class RNTupleMergeStrategySlow;
38class RNTupleAttrMergeActionsDefault;
39struct RNTupleSlowMergeData;
55 static const char *
const kMergingModeStr[] = {
"Filter",
"Strict",
"Union"};
56 return kMergingModeStr[
static_cast<int>(
mode)];
118 template <
typename T>
120 std::string_view attrSetName,
123 static_assert(std::is_base_of_v<RNTupleAttrMergeActions, T>,
124 "actions' class must inherit from RNTupleAttrMergeActions!");
126 return !noPreviousActionsExisted;
257 std::unique_ptr<ROOT::RNTupleModel>
fModel;
262 RNTupleMerger(std::unique_ptr<ROOT::Internal::RPagePersistentSink> destination,
263 std::unique_ptr<ROOT::RNTupleModel> model);
267 explicit RNTupleMerger(std::unique_ptr<ROOT::Internal::RPagePersistentSink> destination);
Option_t Option_t TPoint TPoint const char mode
Merge Actions used internally to merge attributes.
Like RNTupleMergeActions, but performed specifically on attributes.
RNTupleAttrMergeActions(RNTupleAttrMergeActions &&)=default
virtual ENTupleMergeActionResult BeforeCommit(ROOT::REntry &, ROOT::RNTupleAttrRange &, const RNTupleMergeActionContext &)
Invoked at the end of the merge process, right before committing the dataset.
RNTupleAttrMergeActions & operator=(RNTupleAttrMergeActions &&)=default
RNTupleAttrMergeActions(const RNTupleAttrMergeActions &)=delete
RNTupleAttrMergeActions & operator=(const RNTupleAttrMergeActions &)=delete
virtual ~RNTupleAttrMergeActions()=default
RNTupleAttrMergeActions()=default
virtual ENTupleMergeActionResult OnFill(ROOT::REntry &, ROOT::RNTupleAttrRange &, const RNTupleMergeActionContext &)
Invoked every time an entry is merged from a source RNTuple to the destination RNTuple.
virtual ENTupleMergeActionResult OnSourceEnd(ROOT::REntry &, ROOT::RNTupleAttrRange &, const RNTupleMergeActionContext &)
Invoked at the end of each source's merging process.
Container for callbacks that are invoked during the "slow merge" process.
RNTupleMergeActions & operator=(const RNTupleMergeActions &)=delete
virtual void OnSourceBegin(ROOT::REntry &, const RNTupleMergeActionContext &)
Invoked at the start of each sources's merging process.
virtual ENTupleMergeActionResult OnFill(ROOT::REntry &, const RNTupleMergeActionContext &)
Invoked every time an entry is merged from a source RNTuple to the destination RNTuple.
RNTupleMergeActions(RNTupleMergeActions &&)=default
RNTupleMergeActions(const RNTupleMergeActions &)=delete
RNTupleMergeActions()=default
RNTupleMergeActions & operator=(RNTupleMergeActions &&)=default
virtual ENTupleMergeActionResult OnSourceEnd(ROOT::REntry &, const RNTupleMergeActionContext &)
Invoked at the end of each source's merging process.
virtual ENTupleMergeActionResult BeforeCommit(ROOT::REntry &, const RNTupleMergeActionContext &)
Invoked at the end of the merge process, right before committing the dataset.
virtual ~RNTupleMergeActions()=default
Given a set of RPageSources merge them into an RPagePersistentSink, optionally changing their compres...
std::unique_ptr< ROOT::RNTupleModel > fModel
RNTupleMerger(std::unique_ptr< ROOT::Internal::RPagePersistentSink > destination, std::unique_ptr< ROOT::RNTupleModel > model)
Creates a RNTupleMerger with the given destination.
std::unique_ptr< ROOT::Internal::RPagePersistentSink > fDestination
RResult< void > Merge(std::span< ROOT::Internal::RPageSource * > sources, const RNTupleMergeOptions &mergeOpts=RNTupleMergeOptions())
Merge a given set of sources into the destination.
The REntry is a collection of values in an RNTuple corresponding to a complete row in the data set.
A range of main entries referred to by an attribute entry.
The RNTupleModel encapulates the schema of an RNTuple.
Representation of an RNTuple data set in a ROOT file.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
@ kEmitMulti
Emit this entry, then call the function again.
@ kEmit
Emit this entry, then continue.
@ kDrop
Don't emit this entry.
std::function< std::unique_ptr< RNTupleAttrMergeActions >()> RNTupleAttrMergeActionsFactory
ENTupleMergeVersionBehavior
@ kAbortOnHigherVersion
The merger will refuse to merge RNTuples with higher versions than the latest supported by this ROOT ...
@ kWarnOnHigherVersion
The merger will emit a warning when merging RNTuples with higher version than the latest supported by...
const char * ToString(ENTupleMergingMode mode)
@ kAbort
The merger will abort merging as soon as an error is encountered.
@ kSkip
Upon errors, the merger will skip the current source and continue.
@ kStrict
The merger will refuse to merge any 2 RNTuples whose schema doesn't match exactly.
@ kUnion
The merger will update the output model to include all columns from all sources.
@ kFilter
The merger will discard all columns that aren't present in the prototype model (i....
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Information regarding the current slow merge process that gets passed to the RNTupleMergeActions.
ROOT::RNTupleModel * fDstModel
ROOT::NTupleSize_t fSourceEntryIndex
ROOT::NTupleSize_t fDestinationEntryIndex
Set of merging options to pass to RNTupleMerger.
std::unordered_map< std::string_view, RNTupleAttrMergeActionsFactory > fUserAttrMergeActions
ENTupleMergeVersionBehavior fVersionBehavior
Determines how the Merge function behaves depending on the RNTuple sources' version.
bool fExtraVerbose
If true, the merger will emit further diagnostics and information.
bool SetAttributeMergeActions(std::string_view attrSetName, RNTupleAttrMergeActionsFactory factory=[] { return std::unique_ptr< RNTupleAttrMergeActions >(new T());})
Sets the user-defined merge actions associated to attribute set attrSetName to the type returned by f...
std::optional< std::uint32_t > fCompressionSettings
If fCompressionSettings is empty (the default), the merger will not change the compression of any of ...
ENTupleMergingMode fMergingMode
Determines how the merging treats sources with different models (.
ENTupleMergeErrBehavior fErrBehavior
Determines how the Merge function behaves upon merging errors.