@@ -71,39 +71,43 @@ class R__CLING_PTRCHECK(off) RDefine final : public RDefineBase {
7171 std::unordered_map<std::string, std::unique_ptr<RDefineBase>> fVariedDefines ;
7272
7373 template <typename ColType>
74- auto GetValueChecked (unsigned int slot, std::size_t readerIdx, Long64_t entry ) -> ColType &
74+ auto GetValueChecked (unsigned int slot, std::size_t readerIdx, std:: size_t idx ) -> ColType &
7575 {
76- if (auto *val = fValues [slot][readerIdx]->template TryGet <ColType>(entry ))
76+ if (auto *val = fValues [slot][readerIdx]->template TryGet <ColType>(idx ))
7777 return *val;
7878
7979 throw std::out_of_range{" RDataFrame: Define could not retrieve value for column '" + fColumnNames [readerIdx] +
80- " ' for entry " + std::to_string (entry ) +
80+ " ' for entry " + std::to_string (idx ) +
8181 " . You can use the DefaultValueFor operation to provide a default value, or "
8282 " FilterAvailable/FilterMissing to discard/keep entries with missing values instead." };
8383 }
8484
8585 template <typename ... ColTypes, std::size_t ... S>
86- void UpdateHelper (unsigned int slot, Long64_t entry, TypeList<ColTypes...>, std::index_sequence<S...>, NoneTag)
86+ void UpdateHelper (unsigned int slot, std::size_t idx, Long64_t /* entry*/ , TypeList<ColTypes...>,
87+ std::index_sequence<S...>, NoneTag)
8788 {
8889 fLastResults [slot * RDFInternal::CacheLineStep<ret_type>()] =
89- fExpression (GetValueChecked<ColTypes>(slot, S, entry )...);
90- (void )entry ; // avoid unused parameter warning (gcc 12.1)
90+ fExpression (GetValueChecked<ColTypes>(slot, S, idx )...);
91+ (void )idx ; // avoid unused parameter warning (gcc 12.1)
9192 }
9293
9394 template <typename ... ColTypes, std::size_t ... S>
94- void UpdateHelper (unsigned int slot, Long64_t entry, TypeList<ColTypes...>, std::index_sequence<S...>, SlotTag)
95+ void UpdateHelper (unsigned int slot, std::size_t idx, Long64_t /* entry*/ , TypeList<ColTypes...>,
96+ std::index_sequence<S...>, SlotTag)
9597 {
9698 fLastResults [slot * RDFInternal::CacheLineStep<ret_type>()] =
97- fExpression (slot, GetValueChecked<ColTypes>(slot, S, entry )...);
98- (void )entry ; // avoid unused parameter warning (gcc 12.1)
99+ fExpression (slot, GetValueChecked<ColTypes>(slot, S, idx )...);
100+ (void )idx ; // avoid unused parameter warning (gcc 12.1)
99101 }
100102
101103 template <typename ... ColTypes, std::size_t ... S>
102- void
103- UpdateHelper ( unsigned int slot, Long64_t entry, TypeList<ColTypes...>, std::index_sequence<S...>, SlotAndEntryTag)
104+ void UpdateHelper ( unsigned int slot, std:: size_t idx, Long64_t batchFirstEntry, TypeList<ColTypes...>,
105+ std::index_sequence<S...>, SlotAndEntryTag)
104106 {
105107 fLastResults [slot * RDFInternal::CacheLineStep<ret_type>()] =
106- fExpression (slot, entry, GetValueChecked<ColTypes>(slot, S, entry)...);
108+ fExpression (slot, batchFirstEntry + idx, GetValueChecked<ColTypes>(slot, S, idx)...);
109+ (void )idx; // avoid unused parameter warning (gcc 12.1)
110+ (void )batchFirstEntry; // avoid unused parameter warning (gcc 12.1)
107111 }
108112
109113public:
@@ -134,12 +138,14 @@ public:
134138 }
135139
136140 // / Update the value at the address returned by GetValuePtr with the content corresponding to the given entry
137- void Update (unsigned int slot, Long64_t entry) final
141+ void Update (unsigned int slot, Long64_t entry, bool mask ) final
138142 {
139143 if (entry != fLastCheckedEntry [slot * RDFInternal::CacheLineStep<Long64_t>()]) {
140- // evaluate this define expression, cache the result
141- UpdateHelper (slot, entry, ColumnTypes_t{}, TypeInd_t{}, ExtraArgsTag{});
142- fLastCheckedEntry [slot * RDFInternal::CacheLineStep<Long64_t>()] = entry;
144+ std::for_each (fValues [slot].begin (), fValues [slot].end (), [entry, mask](auto *v) { v->Load (entry, mask); });
145+ if (mask) {
146+ UpdateHelper (slot, /* idx=*/ 0u , entry, ColumnTypes_t{}, TypeInd_t{}, ExtraArgsTag{});
147+ fLastCheckedEntry [slot * RDFInternal::CacheLineStep<Long64_t>()] = entry;
148+ }
143149 }
144150 }
145151
0 commit comments