Project
Loading...
Searching...
No Matches
ASoA.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_FRAMEWORK_ASOA_H_
13#define O2_FRAMEWORK_ASOA_H_
14
16#include "Framework/Pack.h" // IWYU pragma: export
17#include "Framework/FunctionalHelpers.h" // IWYU pragma: export
18#include "Headers/DataHeader.h" // IWYU pragma: export
19#include "Headers/DataHeaderHelpers.h" // IWYU pragma: export
20#include "Framework/CompilerBuiltins.h" // IWYU pragma: export
21#include "Framework/Traits.h" // IWYU pragma: export
22#include "Framework/Expressions.h" // IWYU pragma: export
23#include "Framework/ArrowTypes.h" // IWYU pragma: export
24#include "Framework/ArrowTableSlicingCache.h" // IWYU pragma: export
25#include "Framework/SliceCache.h" // IWYU pragma: export
26#include "Framework/VariantHelpers.h" // IWYU pragma: export
27#include <arrow/array/array_binary.h>
28#include <arrow/table.h> // IWYU pragma: export
29#include <arrow/array.h> // IWYU pragma: export
30#include <arrow/util/config.h> // IWYU pragma: export
31#include <gandiva/selection_vector.h> // IWYU pragma: export
32#include <array> // IWYU pragma: export
33#include <cassert>
34#include <fmt/format.h>
35#include <concepts>
36#include <cstring>
37#include <gsl/span> // IWYU pragma: export
38
39namespace o2::framework
40{
41using ListVector = std::vector<std::vector<int64_t>>;
42
43std::string cutString(std::string&& str);
44std::string strToUpper(std::string&& str);
45} // namespace o2::framework
46
47struct TClass;
48
49namespace o2::soa
50{
51void accessingInvalidIndexFor(const char* getter);
52void dereferenceWithWrongType(const char* getter, const char* target);
53void missingFilterDeclaration(int hash, int ai);
54void notBoundTable(const char* tableName);
55void* extractCCDBPayload(char* payload, size_t size, TClass const* cl, const char* what);
56
57template <typename... C>
59{
60 return std::vector<std::shared_ptr<arrow::Field>>{C::asArrowField()...};
61}
62} // namespace o2::soa
63
64namespace o2::soa
65{
67struct TableRef {
68 consteval TableRef()
69 : label_hash{0},
70 desc_hash{0},
71 origin_hash{0},
72 version{0}
73 {
74 }
75 consteval TableRef(uint32_t _label, uint32_t _desc, uint32_t _origin, uint32_t _version)
76 : label_hash{_label},
77 desc_hash{_desc},
78 origin_hash{_origin},
79 version{_version}
80 {
81 }
82 uint32_t label_hash;
83 uint32_t desc_hash;
84 uint32_t origin_hash;
85 uint32_t version;
86
87 constexpr bool operator==(TableRef const& other) const noexcept
88 {
89 return (this->label_hash == other.label_hash) &&
90 (this->desc_hash == other.desc_hash) &&
91 (this->origin_hash == other.origin_hash) &&
92 (this->version == other.version);
93 }
94
95 constexpr bool descriptionCompatible(TableRef const& other) const noexcept
96 {
97 return this->desc_hash == other.desc_hash;
98 }
99
100 constexpr bool descriptionCompatible(uint32_t _desc_hash) const noexcept
101 {
102 return this->desc_hash == _desc_hash;
103 }
104
105 constexpr TableRef(TableRef const&) = default;
106 constexpr TableRef& operator=(TableRef const&) = default;
107 constexpr TableRef(TableRef&&) = default;
108 constexpr TableRef& operator=(TableRef&&) = default;
109};
110
112template <size_t N1, size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
113consteval auto merge()
114{
115 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](TableRef const& a) { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
116 std::array<TableRef, N1 + N2 - duplicates> out;
117
118 auto pos = std::copy(ar1.begin(), ar1.end(), out.begin());
119 std::copy_if(ar2.begin(), ar2.end(), pos, [&](TableRef const& a) { return std::none_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
120 return out;
121}
122
123template <size_t N1, size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2, typename L>
124consteval auto merge_if(L l)
125{
126 constexpr const int to_remove = std::ranges::count_if(ar1.begin(), ar1.end(), [&](TableRef const& a) { return !l(a); });
127 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](TableRef const& a) { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }) || !l(a); });
128 std::array<TableRef, N1 + N2 - duplicates - to_remove> out;
129
130 auto pos = std::copy_if(ar1.begin(), ar1.end(), out.begin(), [&](TableRef const& a) { return l(a); });
131 std::copy_if(ar2.begin(), ar2.end(), pos, [&](TableRef const& a) { return std::none_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }) && l(a); });
132 return out;
133}
134
135template <size_t N, std::array<TableRef, N> ar, typename L>
136consteval auto remove_if(L l)
137{
138 constexpr const int to_remove = std::ranges::count_if(ar.begin(), ar.end(), [&l](TableRef const& e) { return l(e); });
139 std::array<TableRef, N - to_remove> out;
140 std::copy_if(ar.begin(), ar.end(), out.begin(), [&l](TableRef const& e) { return !l(e); });
141 return out;
142}
143
144template <size_t N1, size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
145consteval auto intersect()
146{
147 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](TableRef const& a) { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
148 std::array<TableRef, duplicates> out;
149 std::copy_if(ar1.begin(), ar1.end(), out.begin(), [](TableRef const& a) { return std::find(ar2.begin(), ar2.end(), a) != ar2.end(); });
150 return out;
151}
152
153template <typename T, typename... Ts>
154consteval auto mergeOriginals()
155 requires(sizeof...(Ts) == 1)
156{
158 return merge<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
159}
160
161template <typename T, typename... Ts>
162consteval auto mergeOriginals()
163 requires(sizeof...(Ts) > 1)
164{
165 constexpr auto tail = mergeOriginals<Ts...>();
166 return merge<T::originals.size(), tail.size(), T::originals, tail>();
167}
168
169template <typename T, typename... Ts>
170 requires(sizeof...(Ts) == 1)
171consteval auto intersectOriginals()
172{
174 return intersect<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
175}
176
177template <typename T, typename... Ts>
178 requires(sizeof...(Ts) > 1)
179consteval auto intersectOriginals()
180{
181 constexpr auto tail = intersectOriginals<Ts...>();
182 return intersect<T::originals.size(), tail.size(), T::originals, tail>();
183}
184} // namespace o2::soa
185
186namespace o2::soa
187{
188struct Binding;
189
190template <typename T>
191concept not_void = requires { !std::same_as<T, void>; };
192
194template <typename C>
195concept is_persistent_column = requires(C c) { c.mColumnIterator; };
196
197template <typename C>
199
200template <typename C>
201using is_persistent_column_t = std::conditional_t<is_persistent_column<C>, std::true_type, std::false_type>;
202
203template <typename C>
204concept is_self_index_column = not_void<typename C::self_index_t> && std::same_as<typename C::self_index_t, std::true_type>;
205
206template <typename C>
208 { c.setCurrentRaw(b) } -> std::same_as<bool>;
209 requires std::same_as<decltype(c.mBinding), o2::soa::Binding>;
210};
211
212template <typename C>
213using is_external_index_t = typename std::conditional_t<is_index_column<C>, std::true_type, std::false_type>;
214
215template <typename C>
216using is_self_index_t = typename std::conditional_t<is_self_index_column<C>, std::true_type, std::false_type>;
217} // namespace o2::soa
218
219namespace o2::aod
220{
221namespace
222{
223template <typename Key, size_t N, std::array<bool, N> map>
224static consteval int getIndexPosToKey_impl()
225{
226 constexpr const auto pos = std::find(map.begin(), map.end(), true);
227 if constexpr (pos != map.end()) {
228 return std::distance(map.begin(), pos);
229 } else {
230 return -1;
231 }
232}
233} // namespace
234
236template <typename D, typename... Cs>
238 using columns = framework::pack<Cs...>;
242
243 template <typename Key, typename... PCs>
244 static consteval std::array<bool, sizeof...(PCs)> getMap(framework::pack<PCs...>)
245 {
246 return std::array<bool, sizeof...(PCs)>{[]() {
247 if constexpr (requires { PCs::index_targets.size(); }) {
248 return Key::template isIndexTargetOf<PCs::index_targets.size(), PCs::index_targets>();
249 } else {
250 return false;
251 }
252 }()...};
253 }
254
255 template <typename Key>
256 static consteval int getIndexPosToKey()
257 {
258 return getIndexPosToKey_impl<Key, framework::pack_size(persistent_columns_t{}), getMap<Key>(persistent_columns_t{})>();
259 }
260
261 static std::shared_ptr<arrow::Schema> getSchema()
262 {
263 return std::make_shared<arrow::Schema>([]<typename... C>(framework::pack<C...>&& p) { return o2::soa::createFieldsFromColumns(p); }(persistent_columns_t{}));
264 }
265};
266
267template <typename D>
269 using metadata = void;
270};
271
274template <uint32_t H>
275struct Hash {
276 static constexpr uint32_t hash = H;
277 static constexpr char const* const str{""};
278};
279
281template <size_t N, std::array<soa::TableRef, N> ar, typename Key>
282consteval auto filterForKey()
283{
284 constexpr std::array<bool, N> test = []<size_t... Is>(std::index_sequence<Is...>) {
285 return std::array<bool, N>{(Key::template hasOriginal<ar[Is]>() || (o2::aod::MetadataTrait<o2::aod::Hash<ar[Is].desc_hash>>::metadata::template getIndexPosToKey<Key>() >= 0))...};
286 }(std::make_index_sequence<N>());
287 constexpr int correct = std::ranges::count(test.begin(), test.end(), true);
288 std::array<soa::TableRef, correct> out;
289 std::ranges::copy_if(ar.begin(), ar.end(), out.begin(), [&test](soa::TableRef const& r) { return test[std::distance(ar.begin(), std::find(ar.begin(), ar.end(), r))]; });
290 return out;
291}
292
294#define O2HASH(_Str_) \
295 template <> \
296 struct Hash<_Str_ ""_h> { \
297 static constexpr uint32_t hash = _Str_ ""_h; \
298 static constexpr char const* const str{_Str_}; \
299 };
300
302#define O2ORIGIN(_Str_) \
303 template <> \
304 struct Hash<_Str_ ""_h> { \
305 static constexpr header::DataOrigin origin{_Str_}; \
306 static constexpr uint32_t hash = _Str_ ""_h; \
307 static constexpr char const* const str{_Str_}; \
308 };
309
311static inline constexpr uint32_t version(const char* const str)
312{
313 if (str[0] == '\0') {
314 return 0;
315 }
316 size_t len = 0;
317 uint32_t res = 0;
318 while (str[len] != '/' && str[len] != '\0') {
319 ++len;
320 }
321 if (str[len - 1] == '\0') {
322 return -1;
323 }
324 for (auto i = len + 1; str[i] != '\0'; ++i) {
325 res = res * 10 + (int)(str[i] - '0');
326 }
327 return res;
328}
329
331static inline constexpr std::string_view description_str(const char* const str)
332{
333 size_t len = 0;
334 while (len < 15 && str[len] != '/') {
335 ++len;
336 }
337 return std::string_view{str, len};
338}
339
340static inline constexpr header::DataDescription description(const char* const str)
341{
342 size_t len = 0;
343 while (len < 15 && str[len] != '/') {
344 ++len;
345 }
346 char out[16];
347 for (auto i = 0; i < 16; ++i) {
348 out[i] = 0;
349 }
350 std::memcpy(out, str, len);
351 return {out};
352}
353
354// Helpers to get strings from TableRef
355template <soa::TableRef R>
356consteval const char* label()
357{
358 return o2::aod::Hash<R.label_hash>::str;
359}
360
361template <soa::TableRef R>
362consteval const char* origin_str()
363{
364 return o2::aod::Hash<R.origin_hash>::str;
365}
366
367template <soa::TableRef R>
369{
370 return o2::aod::Hash<R.origin_hash>::origin;
371}
372
373template <soa::TableRef R>
374consteval const char* signature()
375{
376 return o2::aod::Hash<R.desc_hash>::str;
377}
378
379template <soa::TableRef R>
381{
382 return {origin<R>(), description(signature<R>()), R.version};
383}
384
386template <typename T>
387concept is_aod_hash = requires(T t) { t.hash; t.str; };
388
389template <typename T>
390concept is_origin_hash = is_aod_hash<T> && requires(T t) { t.origin; };
391
393template <soa::TableRef R>
394static constexpr auto sourceSpec()
395{
396 return fmt::format("{}/{}/{}/{}", label<R>(), origin_str<R>(), description_str(signature<R>()), R.version);
397}
398
400template <size_t N, std::array<soa::TableRef, N> ar, o2::aod::is_origin_hash O>
401consteval auto replaceOrigin()
402{
403 std::array<soa::TableRef, N> res;
404 for (auto i = 0U; i < N; ++i) {
405 res[i].label_hash = ar[i].label_hash;
406 res[i].desc_hash = ar[i].desc_hash;
407 res[i].origin_hash = O::hash;
408 res[i].version = ar[i].version;
409 }
410 return res;
411}
412} // namespace o2::aod
413
414namespace o2::soa
415{
416template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O, typename... Ts>
417class Table;
418
420struct Binding {
421 void const* ptr = nullptr;
422 uint32_t hash = 0;
423 // std::span<TableRef const> refs;
424
425 template <typename T>
426 void bind(T const* table)
427 {
428 ptr = table;
429 hash = o2::framework::TypeIdHelpers::uniqueId<T>();
430 // refs = std::span{T::originals};
431 }
432
433 template <typename T>
434 T const* get() const
435 {
436 if (hash == o2::framework::TypeIdHelpers::uniqueId<T>()) {
437 return static_cast<T const*>(ptr);
438 }
439 return nullptr;
440 }
441};
442
443using SelectionVector = std::vector<int64_t>;
444
445template <typename T>
447
448template <typename T>
450
451template <typename T>
453
454template <typename T>
456
457template <typename T>
459
460template <typename T>
461concept has_configurable_extension = has_extension<T> && requires(T t) { typename T::configurable_t; requires std::same_as<std::true_type, typename T::configurable_t>; };
462
463template <typename T>
464concept is_spawnable_column = std::same_as<typename T::spawnable_t, std::true_type>;
465
466template <typename B, typename E>
468 constexpr static bool value = false;
469};
470
471template <aod::is_aod_hash A, aod::is_aod_hash B>
473 constexpr static bool value = false;
474};
475
476template <typename B, typename E>
478
479template <aod::is_aod_hash A, aod::is_aod_hash B>
481
485struct Chunked {
486 constexpr static bool chunked = true;
487};
488
491struct Flat {
492 constexpr static bool chunked = false;
493};
494
496template <typename T>
497struct unwrap {
498 using type = T;
499};
500
501template <typename T>
502struct unwrap<std::vector<T>> {
503 using type = T;
504};
505
506template <>
507struct unwrap<bool> {
508 using type = char;
509};
510
511template <typename T>
512using unwrap_t = typename unwrap<T>::type;
513
518template <typename T, typename ChunkingPolicy = Chunked>
519class ColumnIterator : ChunkingPolicy
520{
521 static constexpr char SCALE_FACTOR = std::same_as<std::decay_t<T>, bool> ? 3 : 0;
522
523 public:
528 ColumnIterator(arrow::ChunkedArray const* column)
529 : mColumn{column},
530 mCurrent{nullptr},
531 mCurrentPos{nullptr},
532 mLast{nullptr},
533 mFirstIndex{0},
534 mCurrentChunk{0},
535 mOffset{0}
536 {
537 auto array = getCurrentArray();
538 mCurrent = reinterpret_cast<unwrap_t<T> const*>(array->values()->data()) + (mOffset >> SCALE_FACTOR);
539 mLast = mCurrent + array->length();
540 }
541
542 ColumnIterator() = default;
545
548
550 void nextChunk() const
551 {
552 auto previousArray = getCurrentArray();
553 mFirstIndex += previousArray->length();
554
556 auto array = getCurrentArray();
557 mCurrent = reinterpret_cast<unwrap_t<T> const*>(array->values()->data()) + (mOffset >> SCALE_FACTOR) - (mFirstIndex >> SCALE_FACTOR);
558 mLast = mCurrent + array->length() + (mFirstIndex >> SCALE_FACTOR);
559 }
560
561 void prevChunk() const
562 {
563 auto previousArray = getCurrentArray();
564 mFirstIndex -= previousArray->length();
565
567 auto array = getCurrentArray();
568 mCurrent = reinterpret_cast<unwrap_t<T> const*>(array->values()->data()) + (mOffset >> SCALE_FACTOR) - (mFirstIndex >> SCALE_FACTOR);
569 mLast = mCurrent + array->length() + (mFirstIndex >> SCALE_FACTOR);
570 }
571
572 void moveToChunk(int chunk)
573 {
574 if (mCurrentChunk < chunk) {
575 while (mCurrentChunk != chunk) {
576 nextChunk();
577 }
578 } else {
579 while (mCurrentChunk != chunk) {
580 prevChunk();
581 }
582 }
583 }
584
587 {
588 mCurrentChunk = mColumn->num_chunks() - 1;
589 auto array = getCurrentArray();
590 mFirstIndex = mColumn->length() - array->length();
591 mCurrent = reinterpret_cast<unwrap_t<T> const*>(array->values()->data()) + (mOffset >> SCALE_FACTOR) - (mFirstIndex >> SCALE_FACTOR);
592 mLast = mCurrent + array->length() + (mFirstIndex >> SCALE_FACTOR);
593 }
594
595 auto operator*() const
596 requires std::same_as<bool, std::decay_t<T>>
597 {
598 checkSkipChunk();
599 return (*(mCurrent - (mOffset >> SCALE_FACTOR) + ((*mCurrentPos + mOffset) >> SCALE_FACTOR)) & (1 << ((*mCurrentPos + mOffset) & 0x7))) != 0;
600 }
601
602 auto operator*() const
603 requires((!std::same_as<bool, std::decay_t<T>>) && std::same_as<arrow_array_for_t<T>, arrow::ListArray>)
604 {
605 checkSkipChunk();
606 auto list = std::static_pointer_cast<arrow::ListArray>(mColumn->chunk(mCurrentChunk));
607 auto offset = list->value_offset(*mCurrentPos - mFirstIndex);
608 auto length = list->value_length(*mCurrentPos - mFirstIndex);
609 return gsl::span<unwrap_t<T> const>{mCurrent + mFirstIndex + offset, mCurrent + mFirstIndex + (offset + length)};
610 }
611
612 decltype(auto) operator*() const
613 requires((!std::same_as<bool, std::decay_t<T>>) && std::same_as<arrow_array_for_t<T>, arrow::BinaryViewArray>)
614 {
615 checkSkipChunk();
616 auto array = std::static_pointer_cast<arrow::BinaryViewArray>(mColumn->chunk(mCurrentChunk));
617 return array->GetView(*mCurrentPos - mFirstIndex);
618 }
619
620 decltype(auto) operator*() const
621 requires((!std::same_as<bool, std::decay_t<T>>) && !std::same_as<arrow_array_for_t<T>, arrow::ListArray> && !std::same_as<arrow_array_for_t<T>, arrow::BinaryViewArray>)
622 {
623 checkSkipChunk();
624 return *(mCurrent + (*mCurrentPos >> SCALE_FACTOR));
625 }
626
627 // Move to the chunk which containts element pos
629 {
630 checkSkipChunk();
631 return *this;
632 }
633
634 mutable unwrap_t<T> const* mCurrent;
636 mutable unwrap_t<T> const* mLast;
637 arrow::ChunkedArray const* mColumn;
638 mutable int mFirstIndex;
639 mutable int mCurrentChunk;
640 mutable int mOffset;
641
642 private:
643 void checkSkipChunk() const
644 requires((ChunkingPolicy::chunked == true) && std::same_as<arrow_array_for_t<T>, arrow::ListArray>)
645 {
646 auto list = std::static_pointer_cast<arrow::ListArray>(mColumn->chunk(mCurrentChunk));
647 if (O2_BUILTIN_UNLIKELY(*mCurrentPos - mFirstIndex >= list->length())) {
648 nextChunk();
649 }
650 }
651
652 void checkSkipChunk() const
653 requires((ChunkingPolicy::chunked == true) && !std::same_as<arrow_array_for_t<T>, arrow::ListArray>)
654 {
655 if (O2_BUILTIN_UNLIKELY(((mCurrent + (*mCurrentPos >> SCALE_FACTOR)) >= mLast))) {
656 nextChunk();
657 }
658 }
659
660 void checkSkipChunk() const
661 requires(ChunkingPolicy::chunked == false)
662 {
663 }
665 auto getCurrentArray() const
666 requires(std::same_as<arrow_array_for_t<T>, arrow::FixedSizeListArray>)
667 {
668 std::shared_ptr<arrow::Array> chunkToUse = mColumn->chunk(mCurrentChunk);
669 mOffset = chunkToUse->offset();
670 chunkToUse = std::dynamic_pointer_cast<arrow::FixedSizeListArray>(chunkToUse)->values();
671 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
672 }
673
674 auto getCurrentArray() const
675 requires(std::same_as<arrow_array_for_t<T>, arrow::ListArray>)
676 {
677 std::shared_ptr<arrow::Array> chunkToUse = mColumn->chunk(mCurrentChunk);
678 mOffset = chunkToUse->offset();
679 chunkToUse = std::dynamic_pointer_cast<arrow::ListArray>(chunkToUse)->values();
680 mOffset = chunkToUse->offset();
681 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
682 }
683
684 auto getCurrentArray() const
685 requires(!std::same_as<arrow_array_for_t<T>, arrow::FixedSizeListArray> && !std::same_as<arrow_array_for_t<T>, arrow::ListArray>)
686 {
687 std::shared_ptr<arrow::Array> chunkToUse = mColumn->chunk(mCurrentChunk);
688 mOffset = chunkToUse->offset();
689 return std::static_pointer_cast<arrow_array_for_t<T>>(chunkToUse);
690 }
691};
692
693template <typename T, typename INHERIT>
694struct Column {
695 using inherited_t = INHERIT;
697 : mColumnIterator{it}
698 {
699 }
700
701 Column() = default;
702 Column(Column const&) = default;
703 Column& operator=(Column const&) = default;
704
705 Column(Column&&) = default;
706 Column& operator=(Column&&) = default;
707
708 using type = T;
709 static constexpr const char* const& columnLabel() { return INHERIT::mLabel; }
711 {
712 return mColumnIterator;
713 }
714
715 static auto asArrowField()
716 {
717 return std::make_shared<arrow::Field>(inherited_t::mLabel, soa::asArrowDataType<type>());
718 }
719
723};
724
727template <typename F, typename INHERIT>
729 using inherited_t = INHERIT;
730
731 static constexpr const char* const& columnLabel() { return INHERIT::mLabel; }
732};
733
734template <typename INHERIT>
736 using inherited_t = INHERIT;
737 static constexpr const uint32_t hash = 0;
738
739 static constexpr const char* const& columnLabel() { return INHERIT::mLabel; }
740};
741
742template <typename INHERIT>
744 using inherited_t = INHERIT;
745 static constexpr const uint32_t hash = 0;
746
747 static constexpr const char* const& columnLabel() { return INHERIT::mLabel; }
748};
749
750template <size_t M = 0>
751struct Marker : o2::soa::MarkerColumn<Marker<M>> {
752 using type = size_t;
754 constexpr inline static auto value = M;
755
756 Marker() = default;
757 Marker(Marker const&) = default;
758 Marker(Marker&&) = default;
759
760 Marker& operator=(Marker const&) = default;
761 Marker& operator=(Marker&&) = default;
762
763 Marker(arrow::ChunkedArray const*) {}
764 constexpr inline auto mark()
765 {
766 return value;
767 }
768
769 static constexpr const char* mLabel = "Marker";
770};
771
772template <int64_t START = 0, int64_t END = -1>
773struct Index : o2::soa::IndexColumn<Index<START, END>> {
775 constexpr inline static int64_t start = START;
776 constexpr inline static int64_t end = END;
777
778 Index() = default;
779 Index(Index const&) = default;
780 Index(Index&&) = default;
781
782 Index& operator=(Index const&) = default;
783 Index& operator=(Index&&) = default;
784
785 Index(arrow::ChunkedArray const*)
786 {
787 }
788
789 constexpr inline int64_t rangeStart()
790 {
791 return START;
792 }
793
794 constexpr inline int64_t rangeEnd()
795 {
796 return END;
797 }
798
799 [[nodiscard]] int64_t index() const
800 {
801 return index<0>();
802 }
803
804 [[nodiscard]] int64_t filteredIndex() const
805 {
806 return index<1>();
807 }
808
809 [[nodiscard]] int64_t globalIndex() const
810 {
811 return index<0>() + offsets<0>();
812 }
813
814 template <int N = 0>
815 [[nodiscard]] int64_t index() const
816 {
817 return *std::get<N>(rowIndices);
818 }
819
820 template <int N = 0>
821 [[nodiscard]] int64_t offsets() const
822 {
823 return *std::get<N>(rowOffsets);
824 }
825
826 void setIndices(std::tuple<int64_t const*, int64_t const*> indices)
827 {
829 }
830
831 void setOffsets(std::tuple<uint64_t const*> offsets)
832 {
834 }
835
836 static constexpr const char* mLabel = "Index";
837 using type = int64_t;
838
839 std::tuple<int64_t const*, int64_t const*> rowIndices;
842 std::tuple<uint64_t const*> rowOffsets;
843};
844
845template <typename C>
846concept is_indexing_column = requires(C& c) {
847 c.rowIndices;
848 c.rowOffsets;
849};
850
851template <typename C>
852concept is_dynamic_column = requires(C& c) {
853 c.boundIterators;
854};
855
856template <typename C>
857concept is_marker_column = requires { &C::mark; };
858
859template <typename T>
860using is_dynamic_t = std::conditional_t<is_dynamic_column<T>, std::true_type, std::false_type>;
861
862template <typename T>
864
865template <typename T>
866using is_indexing_t = std::conditional_t<is_indexing_column<T>, std::true_type, std::false_type>;
867
872 uint64_t mOffset = 0;
873};
874
877};
878
880 // We use -1 in the IndexPolicyBase to indicate that the index is
881 // invalid. What will validate the index is the this->setCursor()
882 // which happens below which will properly setup the first index
883 // by remapping the filtered index 0 to whatever unfiltered index
884 // it belongs to.
885 FilteredIndexPolicy(std::span<int64_t const> selection, int64_t rows, uint64_t offset = 0)
886 : IndexPolicyBase{-1, offset},
887 mSelectedRows(selection),
888 mMaxSelection(selection.size()),
889 nRows{rows}
890 {
891 this->setCursor(0);
892 }
893
894 void resetSelection(std::span<int64_t const> selection)
895 {
896 mSelectedRows = selection;
897 mMaxSelection = selection.size();
898 this->setCursor(0);
899 }
900
906
907 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
909 {
910 return std::make_tuple(&mRowIndex, &mSelectionRow);
911 }
912
913 [[nodiscard]] std::tuple<uint64_t const*>
915 {
916 return std::make_tuple(&mOffset);
917 }
918
920 {
921 this->setCursor(start);
922 if (end >= 0) {
923 mMaxSelection = std::min(end, mMaxSelection);
924 }
925 }
926
928 {
929 mSelectionRow = i;
930 updateRow();
931 }
932
934 {
935 mSelectionRow += i;
936 updateRow();
937 }
938
939 friend bool operator==(FilteredIndexPolicy const& lh, FilteredIndexPolicy const& rh)
940 {
941 return lh.mSelectionRow == rh.mSelectionRow;
942 }
943
944 bool operator==(RowViewSentinel const& sentinel) const
945 {
946 return O2_BUILTIN_UNLIKELY(mSelectionRow == sentinel.index);
947 }
948
953 {
954 this->mSelectionRow = this->mMaxSelection;
955 this->mRowIndex = -1;
956 }
957
958 [[nodiscard]] auto getSelectionRow() const
959 {
960 return mSelectionRow;
961 }
962
963 [[nodiscard]] auto size() const
964 {
965 return mMaxSelection;
966 }
967
968 [[nodiscard]] auto raw_size() const
969 {
970 return nRows;
971 }
972
973 private:
974 inline void updateRow()
975 {
976 this->mRowIndex = O2_BUILTIN_LIKELY(mSelectionRow < mMaxSelection) ? mSelectedRows[mSelectionRow] : -1;
977 }
978 std::span<int64_t const> mSelectedRows;
979 int64_t mSelectionRow = 0;
980 int64_t mMaxSelection = 0;
981 int64_t nRows = 0;
982};
983
991
997 mMaxRow(nRows)
998 {
999 }
1000
1003 mMaxRow(other.raw_size())
1004 {
1005 }
1006
1008 {
1009 this->setCursor(start);
1010 if (end >= 0) {
1011 mMaxRow = std::min(end, mMaxRow);
1012 }
1013 }
1014
1015 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
1017 {
1018 return std::make_tuple(&mRowIndex, &mRowIndex);
1019 }
1020
1021 [[nodiscard]] std::tuple<uint64_t const*>
1023 {
1024 return std::make_tuple(&mOffset);
1025 }
1026
1028 {
1029 this->mRowIndex = i;
1030 }
1032 {
1033 this->mRowIndex += i;
1034 }
1035
1037 {
1038 this->setCursor(mMaxRow);
1039 }
1040
1041 friend bool operator==(DefaultIndexPolicy const& lh, DefaultIndexPolicy const& rh)
1042 {
1043 return lh.mRowIndex == rh.mRowIndex;
1044 }
1045
1046 bool operator==(RowViewSentinel const& sentinel) const
1047 {
1048 return O2_BUILTIN_UNLIKELY(this->mRowIndex == sentinel.index);
1049 }
1050
1051 [[nodiscard]] auto size() const
1052 {
1053 return mMaxRow;
1054 }
1055
1057};
1058
1059// template <OriginEnc ORIGIN, typename... C>
1060// class Table;
1061
1062template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O, typename... T>
1063class Table;
1064
1065template <typename T>
1067
1070template <typename C>
1073 arrow::ChunkedArray* second;
1074};
1075
1076template <typename T, typename B>
1077concept can_bind = requires(T&& t) {
1078 { t.B::mColumnIterator };
1079};
1080
1081template <typename... C>
1083
1084template <typename D, typename O, typename IP, typename... C>
1085struct TableIterator : IP, C... {
1086 public:
1087 using self_t = TableIterator<D, O, IP, C...>;
1088 using policy_t = IP;
1093 using bindings_pack_t = decltype([]<typename... Cs>(framework::pack<Cs...>) -> framework::pack<typename Cs::binding_t...> {}(external_index_columns_t{})); // decltype(extractBindings(external_index_columns_t{}));
1094
1095 TableIterator(arrow::ChunkedArray* columnData[sizeof...(C)], IP&& policy)
1096 : IP{policy},
1097 C(columnData[framework::has_type_at_v<C>(all_columns{})])...
1098 {
1099 if (this->size() != 0) {
1100 bind();
1101 }
1102 }
1103
1104 TableIterator(arrow::ChunkedArray* columnData[sizeof...(C)], IP&& policy)
1105 requires(has_index<C...>)
1106 : IP{policy},
1107 C(columnData[framework::has_type_at_v<C>(all_columns{})])...
1108 {
1109 if (this->size() != 0) {
1110 bind();
1111 }
1112 // In case we have an index column might need to constrain the actual
1113 // number of rows in the view to the range provided by the index.
1114 // FIXME: we should really understand what happens to an index when we
1115 // have a RowViewFiltered.
1116 this->limitRange(this->rangeStart(), this->rangeEnd());
1117 }
1118
1119 TableIterator() = default;
1121 : IP{static_cast<IP const&>(other)},
1122 C(static_cast<C const&>(other))...
1123 {
1124 if (this->size() != 0) {
1125 bind();
1126 }
1127 }
1128
1130 {
1131 IP::operator=(static_cast<IP const&>(other));
1132 (void(static_cast<C&>(*this) = static_cast<C>(other)), ...);
1133 if (this->size() != 0) {
1134 bind();
1135 }
1136 return *this;
1137 }
1138
1140 requires std::same_as<IP, DefaultIndexPolicy>
1141 : IP{static_cast<IP const&>(other)},
1142 C(static_cast<C const&>(other))...
1143 {
1144 if (this->size() != 0) {
1145 bind();
1146 }
1147 }
1148
1150 {
1151 this->moveByIndex(1);
1152 return *this;
1153 }
1154
1156 {
1157 self_t copy = *this;
1158 this->operator++();
1159 return copy;
1160 }
1161
1163 {
1164 this->moveByIndex(-1);
1165 return *this;
1166 }
1167
1169 {
1170 self_t copy = *this;
1171 this->operator--();
1172 return copy;
1173 }
1174
1177 {
1178 TableIterator copy = *this;
1179 copy.moveByIndex(inc);
1180 return copy;
1181 }
1182
1184 {
1185 return operator+(-dec);
1186 }
1187
1189 {
1190 return *this;
1191 }
1192
1193 template <typename CL>
1194 auto getCurrent() const
1195 {
1196 return CL::getCurrentRaw();
1197 }
1198
1199 template <typename... Cs>
1201 {
1202 return std::vector<o2::soa::Binding>{static_cast<Cs const&>(*this).getCurrentRaw()...};
1203 }
1204
1205 auto getIndexBindings() const
1206 {
1208 }
1209
1210 template <typename... TA>
1211 void bindExternalIndices(TA*... current)
1212 {
1213 ([this]<soa::is_index_column... CCs>(TA* cur, framework::pack<CCs...>) {
1214 (CCs::setCurrent(cur), ...);
1215 }(current, external_index_columns_t{}),
1216 ...);
1217 }
1218
1219 template <typename TA>
1220 void bindExternalIndex(TA* current)
1221 {
1222 [this]<soa::is_index_column... CCs>(TA* cur, framework::pack<CCs...>) {
1223 (CCs::setCurrent(cur), ...);
1224 }(current, external_index_columns_t{});
1225 }
1226
1227 template <typename... Cs>
1228 void doSetCurrentIndexRaw(framework::pack<Cs...> p, std::vector<o2::soa::Binding>&& ptrs)
1229 {
1230 (Cs::setCurrentRaw(ptrs[framework::has_type_at_v<Cs>(p)]), ...);
1231 }
1232
1233 template <typename... Cs, typename I>
1235 {
1237 b.bind(ptr);
1238 (Cs::setCurrentRaw(b), ...);
1239 }
1240
1241 void bindExternalIndicesRaw(std::vector<o2::soa::Binding>&& ptrs)
1242 {
1243 doSetCurrentIndexRaw(external_index_columns_t{}, std::forward<std::vector<o2::soa::Binding>>(ptrs));
1244 }
1245
1246 template <typename I>
1247 void bindInternalIndices(I const* table)
1248 {
1250 }
1251
1252 private:
1254 template <typename... PC>
1255 void doMoveToEnd(framework::pack<PC...>)
1256 {
1257 (PC::mColumnIterator.moveToEnd(), ...);
1258 }
1259
1262 void bind()
1263 {
1264 using namespace o2::soa;
1265 auto f = framework::overloaded{
1266 [this]<soa::is_persistent_column T>(T*) -> void { T::mColumnIterator.mCurrentPos = &this->mRowIndex; },
1267 [this]<soa::is_dynamic_column T>(T*) -> void { bindDynamicColumn<T>(typename T::bindings_t{}); },
1268 [this]<typename T>(T*) -> void {},
1269 };
1270 (f(static_cast<C*>(nullptr)), ...);
1271 if constexpr (has_index<C...>) {
1272 this->setIndices(this->getIndices());
1273 this->setOffsets(this->getOffsets());
1274 }
1275 }
1276
1277 template <typename DC, typename... B>
1278 auto bindDynamicColumn(framework::pack<B...>)
1279 {
1280 DC::boundIterators = std::make_tuple(getDynamicBinding<B>()...);
1281 }
1282
1283 // Sometimes dynamic columns are defined for tables in
1284 // the hope that it will be joined / extended with another one which provides
1285 // the full set of bindings. This is to avoid a compilation
1286 // error if constructor for the table or any other thing involving a missing
1287 // binding is preinstanciated.
1288 template <typename B>
1289 requires(can_bind<self_t, B>)
1290 decltype(auto) getDynamicBinding()
1291 {
1292 static_assert(std::same_as<decltype(&(static_cast<B*>(this)->mColumnIterator)), std::decay_t<decltype(B::mColumnIterator)>*>, "foo");
1293 return &(static_cast<B*>(this)->mColumnIterator);
1294 // return static_cast<std::decay_t<decltype(B::mColumnIterator)>*>(nullptr);
1295 }
1296
1297 template <typename B>
1298 decltype(auto) getDynamicBinding()
1299 {
1300 return static_cast<std::decay_t<decltype(B::mColumnIterator)>*>(nullptr);
1301 }
1302};
1303
1305 static std::shared_ptr<arrow::Table> joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
1306 static std::shared_ptr<arrow::Table> joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<const char* const> labels);
1307 static std::shared_ptr<arrow::Table> joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<const std::string> labels);
1308 static std::shared_ptr<arrow::Table> concatTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
1309};
1310
1312template <typename T>
1314
1315template <typename T>
1317
1318template <typename T>
1319concept with_originals = requires {
1320 T::originals.size();
1321};
1322
1323template <typename T>
1324concept with_sources = requires {
1325 T::sources.size();
1326};
1327
1328template <typename T>
1329concept with_sources_generator = requires(T t) {
1330 t.template generateSources<o2::aod::Hash<"AOD"_h>>();
1331};
1332
1333template <typename T>
1334concept with_ccdb_urls = requires {
1335 T::ccdb_urls.size();
1336};
1337
1338template <typename T>
1339concept with_base_table = requires {
1340 typename aod::MetadataTrait<o2::aod::Hash<T::originals[T::originals.size() - 1].desc_hash>>::metadata::base_table_t;
1341};
1342
1343template <typename T>
1344concept with_expression_pack = requires {
1345 typename T::expression_pack_t{};
1346};
1347
1348template <typename T>
1349concept with_index_pack = requires {
1350 typename T::index_pack_t{};
1351};
1352
1353template <size_t N1, std::array<TableRef, N1> os1, size_t N2, std::array<TableRef, N2> os2>
1354consteval bool is_compatible()
1355{
1356 return []<size_t... Is>(std::index_sequence<Is...>) {
1357 return ([]<size_t... Ks>(std::index_sequence<Ks...>) {
1358 constexpr auto h = os1[Is].desc_hash;
1359 using H = o2::aod::Hash<h>;
1360 return (((h == os2[Ks].desc_hash) || is_ng_index_equivalent_v<H, o2::aod::Hash<os2[Ks].desc_hash>>) || ...);
1361 }(std::make_index_sequence<N2>()) ||
1362 ...);
1363 }(std::make_index_sequence<N1>());
1364}
1365
1366template <with_originals T, with_originals B>
1368{
1369 return is_compatible<T::originals.size(), T::originals, B::originals.size(), B::originals>();
1370}
1371
1372template <typename T, typename B>
1373using is_binding_compatible = std::conditional_t<is_binding_compatible_v<T, typename B::binding_t>(), std::true_type, std::false_type>;
1374
1375template <typename L, typename D, typename O, typename Key, typename H, typename... Ts>
1376struct IndexTable;
1377
1378template <typename T>
1380
1381template <soa::is_table T>
1382static constexpr std::string getLabelForTable()
1383{
1384 return std::string{aod::label<std::decay_t<T>::originals[0]>()};
1385}
1386
1387template <soa::is_table T>
1389static constexpr std::string getLabelFromType()
1390{
1391 return getLabelForTable<T>();
1392}
1393
1394template <soa::is_iterator T>
1395static constexpr std::string getLabelFromType()
1396{
1397 return getLabelForTable<typename std::decay_t<T>::parent_t>();
1398}
1399
1400template <soa::is_index_table T>
1401static constexpr std::string getLabelFromType()
1402{
1403 return getLabelForTable<typename std::decay_t<T>::first_t>();
1404}
1405template <soa::with_base_table T>
1406 requires(!soa::is_iterator<T>)
1407static constexpr std::string getLabelFromType()
1408{
1409 return getLabelForTable<typename aod::MetadataTrait<o2::aod::Hash<T::originals[T::originals.size() - 1].desc_hash>>::metadata::base_table_t>();
1410}
1411
1412template <typename... C>
1413static constexpr auto hasColumnForKey(framework::pack<C...>, std::string_view key)
1414{
1415 auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string_view& str2) {
1416 return std::ranges::equal(
1417 str1, str2,
1418 [](char c1, char c2) {
1419 return std::tolower(static_cast<unsigned char>(c1)) ==
1420 std::tolower(static_cast<unsigned char>(c2));
1421 });
1422 };
1423 return (caseInsensitiveCompare(C::inherited_t::mLabel, key) || ...);
1424}
1425
1426template <TableRef ref>
1427static constexpr std::pair<bool, std::string> hasKey(std::string_view key)
1428{
1429 return {hasColumnForKey(typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{}, key), aod::label<ref>()};
1430}
1431
1432template <TableRef ref>
1433static constexpr std::pair<bool, framework::ConcreteDataMatcher> hasKeyM(std::string_view key)
1434{
1435 return {hasColumnForKey(typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{}, key), aod::matcher<ref>()};
1436}
1437
1438void notFoundColumn(const char* label, const char* key);
1439void missingOptionalPreslice(const char* label, const char* key);
1440
1441template <with_originals T, bool OPT = false>
1442static constexpr std::string getLabelFromTypeForKey(std::string_view key)
1443{
1444 auto locate = []<size_t... Is>(std::index_sequence<Is...>, std::string_view key) {
1445 return std::array{hasKey<T::originals[Is]>(key)...} |
1446 std::views::filter([](auto const& x) { return x.first; });
1447 }(std::make_index_sequence<T::originals.size()>{}, key);
1448 if (!locate.empty()) {
1449 return locate.front().second;
1450 }
1451
1452 if constexpr (!OPT) {
1453 notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
1454 } else {
1455 return "[MISSING]";
1456 }
1458}
1459
1460template <with_originals T, bool OPT = false>
1461static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey(std::string_view key)
1462{
1463 auto locate = []<size_t... Is>(std::index_sequence<Is...>, std::string_view key) {
1464 return std::array{hasKeyM<T::originals[Is]>(key)...} |
1465 std::views::filter([](auto const& x) { return x.first; });
1466 }(std::make_index_sequence<T::originals.size()>{}, key);
1467 if (!locate.empty()) {
1468 return locate.front().second;
1469 }
1470
1471 if constexpr (!OPT) {
1472 notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
1473 } else {
1475 }
1477}
1478
1479template <typename B, typename... C>
1480consteval static bool hasIndexTo(framework::pack<C...>&&)
1481{
1482 return (o2::soa::is_binding_compatible_v<B, typename C::binding_t>() || ...);
1483}
1484
1485template <typename B, typename... C>
1486consteval static bool hasSortedIndexTo(framework::pack<C...>&&)
1487{
1488 return ((C::sorted && o2::soa::is_binding_compatible_v<B, typename C::binding_t>()) || ...);
1489}
1490
1491template <typename B, typename Z>
1492consteval static bool relatedByIndex()
1493{
1494 return hasIndexTo<B>(typename Z::table_t::external_index_columns_t{});
1495}
1496
1497template <typename B, typename Z>
1498consteval static bool relatedBySortedIndex()
1499{
1500 return hasSortedIndexTo<B>(typename Z::table_t::external_index_columns_t{});
1501}
1502} // namespace o2::soa
1503
1504namespace o2::framework
1505{
1508 const std::string binding;
1510
1511 bool isMissing() const;
1512 Entry const& getBindingKey() const;
1513};
1514
1516 void updateSliceInfo(SliceInfoPtr&& si);
1517
1519 std::shared_ptr<arrow::Table> getSliceFor(int value, std::shared_ptr<arrow::Table> const& input, uint64_t& offset) const;
1520};
1521
1524
1526 std::span<const int64_t> getSliceFor(int value) const;
1527};
1528
1529template <typename T>
1530concept is_preslice_policy = std::derived_from<T, PreslicePolicyBase>;
1531
1532template <soa::is_table T, is_preslice_policy Policy, bool OPT = false>
1533struct PresliceBase : public Policy {
1534 constexpr static bool optional = OPT;
1535 using target_t = T;
1536 using policy_t = Policy;
1537 const std::string binding;
1538
1540 : Policy{PreslicePolicyBase{{o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.name})}, Entry(o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.name}), o2::soa::getMatcherFromTypeForKey<T, OPT>(std::string{index_.name}), std::string{index_.name})}, {}}
1541 {
1542 }
1543
1544 std::shared_ptr<arrow::Table> getSliceFor(int value, std::shared_ptr<arrow::Table> const& input, uint64_t& offset) const
1545 {
1546 if constexpr (OPT) {
1547 if (Policy::isMissing()) {
1548 return nullptr;
1549 }
1550 }
1551 return Policy::getSliceFor(value, input, offset);
1552 }
1553
1554 std::span<const int64_t> getSliceFor(int value) const
1555 {
1556 if constexpr (OPT) {
1557 if (Policy::isMissing()) {
1558 return {};
1559 }
1560 }
1561 return Policy::getSliceFor(value);
1562 }
1563};
1564
1565template <soa::is_table T>
1567template <soa::is_table T>
1569template <soa::is_table T>
1571template <soa::is_table T>
1573
1574template <typename T>
1575concept is_preslice = std::derived_from<T, PreslicePolicyBase>&&
1576 requires(T)
1577{
1578 T::optional;
1579};
1580
1594};
1595
1596template <typename T>
1597concept is_preslice_group = std::derived_from<T, PresliceGroup>;
1598
1599} // namespace o2::framework
1600
1601namespace o2::soa
1602{
1603template <soa::is_table T>
1604class FilteredBase;
1605template <typename T>
1606class Filtered;
1607
1608template <typename T>
1609concept has_filtered_policy = not_void<typename T::policy_t> && std::same_as<typename T::policy_t, soa::FilteredIndexPolicy>;
1610
1611template <typename T>
1613
1614template <typename T>
1616
1617// FIXME: compatbility declaration to be removed
1618template <typename T>
1620
1621template <typename T>
1623
1624template <typename T>
1626
1628template <typename... Is>
1629static consteval auto extractBindings(framework::pack<Is...>)
1630{
1631 return framework::pack<typename Is::binding_t...>{};
1632}
1633
1635
1636template <typename T, typename C, typename Policy, bool OPT>
1637 requires std::same_as<Policy, framework::PreslicePolicySorted> && (o2::soa::is_binding_compatible_v<C, T>())
1638auto doSliceBy(T const* table, o2::framework::PresliceBase<C, Policy, OPT> const& container, int value)
1639{
1640 if constexpr (OPT) {
1641 if (container.isMissing()) {
1642 missingOptionalPreslice(getLabelFromType<std::decay_t<T>>().data(), container.bindingKey.key.c_str());
1643 }
1644 }
1645 uint64_t offset = 0;
1646 auto out = container.getSliceFor(value, table->asArrowTable(), offset);
1647 auto t = typename T::self_t({out}, offset);
1648 if (t.tableSize() != 0) {
1649 table->copyIndexBindings(t);
1650 t.bindInternalIndicesTo(table);
1651 }
1652 return t;
1653}
1654
1655template <soa::is_filtered_table T>
1656auto doSliceByHelper(T const* table, std::span<const int64_t> const& selection)
1657{
1658 auto t = soa::Filtered<typename T::base_t>({table->asArrowTable()}, selection);
1659 if (t.tableSize() != 0) {
1660 table->copyIndexBindings(t);
1661 t.bindInternalIndicesTo(table);
1662 t.intersectWithSelection(table->getSelectedRows()); // intersect filters
1663 }
1664 return t;
1665}
1666
1667template <soa::is_table T>
1668 requires(!soa::is_filtered_table<T>)
1669auto doSliceByHelper(T const* table, std::span<const int64_t> const& selection)
1670{
1671 auto t = soa::Filtered<T>({table->asArrowTable()}, selection);
1672 if (t.tableSize() != 0) {
1673 table->copyIndexBindings(t);
1674 t.bindInternalIndicesTo(table);
1675 }
1676 return t;
1677}
1678
1679template <typename T, typename C, typename Policy, bool OPT>
1680 requires std::same_as<Policy, framework::PreslicePolicyGeneral> && (o2::soa::is_binding_compatible_v<C, T>())
1681auto doSliceBy(T const* table, o2::framework::PresliceBase<C, Policy, OPT> const& container, int value)
1682{
1683 if constexpr (OPT) {
1684 if (container.isMissing()) {
1685 missingOptionalPreslice(getLabelFromType<std::decay_t<T>>().data(), container.bindingKey.key.c_str());
1686 }
1687 }
1688 auto selection = container.getSliceFor(value);
1689 return doSliceByHelper(table, selection);
1690}
1691
1692SelectionVector sliceSelection(std::span<int64_t const> const& mSelectedRows, int64_t nrows, uint64_t offset);
1693
1694template <soa::is_filtered_table T>
1695auto prepareFilteredSlice(T const* table, std::shared_ptr<arrow::Table> slice, uint64_t offset)
1696{
1697 if (offset >= static_cast<uint64_t>(table->tableSize())) {
1698 Filtered<typename T::base_t> fresult{{{slice}}, SelectionVector{}, 0};
1699 if (fresult.tableSize() != 0) {
1700 table->copyIndexBindings(fresult);
1701 }
1702 return fresult;
1703 }
1704 auto slicedSelection = sliceSelection(table->getSelectedRows(), slice->num_rows(), offset);
1705 Filtered<typename T::base_t> fresult{{{slice}}, std::move(slicedSelection), offset};
1706 if (fresult.tableSize() != 0) {
1707 table->copyIndexBindings(fresult);
1708 }
1709 return fresult;
1710}
1711
1712template <soa::is_filtered_table T, typename C, bool OPT>
1713 requires(o2::soa::is_binding_compatible_v<C, T>())
1715{
1716 if constexpr (OPT) {
1717 if (container.isMissing()) {
1718 missingOptionalPreslice(getLabelFromType<T>().data(), container.bindingKey.key.c_str());
1719 }
1720 }
1721 uint64_t offset = 0;
1722 auto slice = container.getSliceFor(value, table->asArrowTable(), offset);
1723 return prepareFilteredSlice(table, slice, offset);
1724}
1725
1727
1728template <soa::is_table T>
1730{
1731 auto localCache = cache.ptr->getCacheFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1732 node.name});
1733 auto [offset, count] = localCache.getSliceFor(value);
1734 auto t = typename T::self_t({table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count)}, static_cast<uint64_t>(offset));
1735 if (t.tableSize() != 0) {
1736 table->copyIndexBindings(t);
1737 }
1738 return t;
1739}
1740
1741template <soa::is_filtered_table T>
1743{
1744 auto localCache = cache.ptr->getCacheFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1745 node.name});
1746 auto [offset, count] = localCache.getSliceFor(value);
1747 auto slice = table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count);
1748 return prepareFilteredSlice(table, slice, offset);
1749}
1750
1751template <soa::is_table T>
1753{
1754 auto localCache = cache.ptr->getCacheUnsortedFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
1755 node.name});
1756 if constexpr (soa::is_filtered_table<T>) {
1757 auto t = typename T::self_t({table->asArrowTable()}, localCache.getSliceFor(value));
1758 if (t.tableSize() != 0) {
1759 t.intersectWithSelection(table->getSelectedRows());
1760 table->copyIndexBindings(t);
1761 }
1762 return t;
1763 } else {
1764 auto t = Filtered<T>({table->asArrowTable()}, localCache.getSliceFor(value));
1765 if (t.tableSize() != 0) {
1766 table->copyIndexBindings(t);
1767 }
1768 return t;
1769 }
1770}
1771
1772template <with_originals T>
1774{
1775 return Filtered<T>({t.asArrowTable()}, selectionToVector(framework::expressions::createSelection(t.asArrowTable(), f)));
1776}
1777
1778arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, std::string_view label);
1779
1780template <typename D, typename O, typename IP, typename... C>
1781consteval auto base_iter(framework::pack<C...>&&) -> TableIterator<D, O, IP, C...>
1782{
1783}
1784
1785template <TableRef ref, typename... Ts>
1786 requires((sizeof...(Ts) > 0) && (soa::is_column<Ts> && ...))
1787consteval auto getColumns()
1788{
1789 return framework::pack<Ts...>{};
1790}
1791
1792template <TableRef ref, typename... Ts>
1793 requires((sizeof...(Ts) > 0) && !(soa::is_column<Ts> || ...) && (ref.origin_hash == "CONC"_h))
1794consteval auto getColumns()
1795{
1796 return framework::full_intersected_pack_t<typename Ts::columns_t...>{};
1797}
1798
1799template <TableRef ref, typename... Ts>
1800 requires((sizeof...(Ts) > 0) && !(soa::is_column<Ts> || ...) && (ref.origin_hash != "CONC"_h))
1801consteval auto getColumns()
1802{
1803 return framework::concatenated_pack_unique_t<typename Ts::columns_t...>{};
1804}
1805
1806template <TableRef ref, typename... Ts>
1807 requires(sizeof...(Ts) == 0 && soa::has_metadata<aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>>)
1808consteval auto getColumns()
1809{
1810 return typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{};
1811}
1812
1813template <TableRef ref, typename... Ts>
1814 requires((sizeof...(Ts) == 0) || (o2::soa::is_column<Ts> && ...))
1815consteval auto computeOriginals()
1816{
1817 return std::array<TableRef, 1>{ref};
1818}
1819
1820template <TableRef ref, typename... Ts>
1821 requires((sizeof...(Ts) > 0) && (!(o2::soa::is_column<Ts> && ...)))
1822consteval auto computeOriginals()
1823{
1824 return o2::soa::mergeOriginals<Ts...>();
1825}
1826
1829template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O, typename... Ts>
1831{
1832 public:
1833 static constexpr const auto ref = TableRef{L::hash, D::hash, O::hash, o2::aod::version(D::str)};
1834 using self_t = Table<L, D, O, Ts...>;
1836
1837 static constexpr const auto originals = computeOriginals<ref, Ts...>();
1838 static constexpr const auto originalLabels = []<size_t N, std::array<TableRef, N> refs, size_t... Is>(std::index_sequence<Is...>) {
1839 return std::array<const char*, N>{o2::aod::label<refs[Is]>()...};
1840 }.template operator()<originals.size(), originals>(std::make_index_sequence<originals.size()>());
1841 static constexpr const uint32_t binding_origin = originals[0].origin_hash; // commonOrigin<originals.size(), originals>();
1843
1844 template <size_t N, std::array<TableRef, N> bindings>
1845 requires(ref.origin_hash == "CONC"_h)
1846 static consteval auto isIndexTargetOf()
1847 {
1848 return false;
1849 }
1850
1851 template <size_t N, std::array<TableRef, N> bindings>
1852 requires(ref.origin_hash == "JOIN"_h)
1853 static consteval auto isIndexTargetOf()
1854 {
1855 return std::ranges::any_of(self_t::originals,
1856 [](TableRef const& r) {
1857 return std::ranges::any_of(bindings, [&r](TableRef const& b) { return b == r; });
1858 });
1859 }
1860
1861 template <size_t N, std::array<TableRef, N> bindings>
1862 requires(!(ref.origin_hash == "CONC"_h || ref.origin_hash == "JOIN"_h))
1863 static consteval auto isIndexTargetOf()
1864 {
1865 return std::find(bindings.begin(), bindings.end(), self_t::ref) != bindings.end();
1866 }
1867
1868 template <TableRef r>
1869 static consteval bool hasOriginal()
1870 {
1871 return std::ranges::any_of(originals, [](TableRef const& o) { return o.desc_hash == r.desc_hash; });
1872 }
1873
1874 using columns_t = decltype(getColumns<ref, Ts...>());
1875
1878
1881 template <typename IP>
1882 using base_iterator = decltype(base_iter<D, O, IP>(columns_t{}));
1883
1884 template <typename IP, typename Parent, typename... T>
1886 using columns_t = typename Parent::columns_t;
1887 using external_index_columns_t = typename Parent::external_index_columns_t;
1889 // static constexpr const std::array<TableRef, sizeof...(T)> originals{T::ref...};
1890 static constexpr auto originals = Parent::originals;
1891 using policy_t = IP;
1892 using parent_t = Parent;
1893
1895
1896 TableIteratorBase(arrow::ChunkedArray* columnData[framework::pack_size(columns_t{})], IP&& policy)
1897 : base_iterator<IP>(columnData, std::forward<decltype(policy)>(policy))
1898 {
1899 }
1900
1901 template <typename P, typename... Os>
1903 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1904 {
1905 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<IP>>(other);
1906 return *this;
1907 }
1908
1909 template <typename P>
1911 {
1912 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<IP>>(other);
1913 return *this;
1914 }
1915
1916 template <typename P>
1918 requires std::same_as<IP, DefaultIndexPolicy>
1919 {
1920 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<FilteredIndexPolicy>>(other);
1921 return *this;
1922 }
1923
1924 template <typename P, typename O1, typename... Os>
1926 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1927 {
1928 *this = other;
1929 }
1930
1931 template <typename P, typename O1, typename... Os>
1933 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1934 {
1935 *this = other;
1936 }
1937
1938 template <typename P>
1943
1944 template <typename P>
1946 {
1947 *this = other;
1948 }
1949
1950 template <typename P>
1952 requires std::same_as<IP, DefaultIndexPolicy>
1953 {
1954 *this = other;
1955 }
1956
1958 {
1959 this->mRowIndex = other.index;
1960 return *this;
1961 }
1962 template <typename P>
1964 {
1965 this->mRowIndex = other.mRowIndex;
1966 }
1967
1968 template <typename P, typename... Os>
1970 requires std::same_as<typename P::table_t, typename Parent::table_t>
1971 {
1972 this->mRowIndex = other.mRowIndex;
1973 }
1974
1975 template <typename TI>
1976 auto getId() const
1977 {
1978 using decayed = std::decay_t<TI>;
1979 if constexpr (framework::has_type<decayed>(bindings_pack_t{})) { // index to another table
1980 constexpr auto idx = framework::has_type_at_v<decayed>(bindings_pack_t{});
1982 } else if constexpr (std::same_as<decayed, Parent>) { // self index
1983 return this->globalIndex();
1984 } else if constexpr (is_indexing_column<decayed>) { // soa::Index<>
1985 return this->globalIndex();
1986 } else {
1987 return static_cast<int32_t>(-1);
1988 }
1989 }
1990
1991 template <typename CD, typename... CDArgs>
1992 auto getDynamicColumn() const
1993 {
1994 using decayed = std::decay_t<CD>;
1995 static_assert(is_dynamic_t<decayed>(), "Requested column is not a dynamic column");
1996 return static_cast<decayed>(*this).template getDynamicValue<CDArgs...>();
1997 }
1998
1999 template <typename B, typename CC>
2000 auto getValue() const
2001 {
2002 using COL = std::decay_t<CC>;
2003 static_assert(is_dynamic_t<COL>() || soa::is_persistent_column<COL>, "Should be persistent or dynamic column with no argument that has a return type convertable to float");
2004 return static_cast<B>(static_cast<COL>(*this).get());
2005 }
2006
2007 template <typename B, typename... CCs>
2008 std::array<B, sizeof...(CCs)> getValues() const
2009 {
2010 static_assert(std::same_as<B, float> || std::same_as<B, double>, "The common return type should be float or double");
2011 return {getValue<B, CCs>()...};
2012 }
2013
2014 using IP::size;
2015
2016 using base_iterator<IP>::operator++;
2017
2020 {
2021 TableIteratorBase copy = *this;
2022 copy.moveByIndex(inc);
2023 return copy;
2024 }
2025
2027 {
2028 return operator+(-dec);
2029 }
2030
2032 {
2033 return *this;
2034 }
2035 };
2036
2037 template <typename IP, typename Parent, typename... T>
2039
2040 template <typename IP, typename Parent>
2041 static consteval auto full_iter()
2042 {
2043 if constexpr (sizeof...(Ts) == 0) {
2045 } else {
2046 if constexpr ((o2::soa::is_column<Ts> && ...)) {
2048 } else {
2049 return iterator_template<IP, Parent, Ts...>{};
2050 }
2051 }
2052 }
2053
2054 template <typename IP, typename Parent>
2055 using iterator_template_o = decltype(full_iter<IP, Parent>());
2056
2059
2063
2064 static constexpr auto hashes()
2065 {
2066 return []<typename... C>(framework::pack<C...>) { return std::set{{C::hash...}}; }(columns_t{});
2067 }
2068
2069 Table(std::shared_ptr<arrow::Table> table, uint64_t offset = 0)
2070 : mTable(table),
2071 mOffset(offset),
2072 mEnd{table->num_rows()}
2073 {
2074 if (mTable->num_rows() == 0) {
2075 for (size_t ci = 0; ci < framework::pack_size(columns_t{}); ++ci) {
2076 mColumnChunks[ci] = nullptr;
2077 }
2078 mBegin = mEnd;
2079 } else {
2080 auto lookups = [this]<typename... C>(framework::pack<C...>) -> std::array<arrow::ChunkedArray*, framework::pack_size(columns_t{})> { return {lookupColumn<C>()...}; }(columns_t{});
2081 for (size_t ci = 0; ci < framework::pack_size(columns_t{}); ++ci) {
2082 mColumnChunks[ci] = lookups[ci];
2083 }
2084 mBegin = unfiltered_iterator{mColumnChunks, {table->num_rows(), offset}};
2085 mBegin.bindInternalIndices(this);
2086 }
2087 }
2088
2089 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
2090 requires(ref.origin_hash != "CONC"_h)
2091 : Table(ArrowHelpers::joinTables(std::move(tables), std::span{originalLabels}), offset)
2092 {
2093 }
2094
2095 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
2096 requires(ref.origin_hash == "CONC"_h)
2097 : Table(ArrowHelpers::concatTables(std::move(tables)), offset)
2098 {
2099 }
2100
2101 template <typename Key>
2102 inline arrow::ChunkedArray* getIndexToKey()
2103 {
2104 constexpr auto map = []<typename... Cs>(framework::pack<Cs...>) {
2105 return std::array<bool, sizeof...(Cs)>{[]() {
2106 if constexpr (requires { Cs::index_targets.size(); }) {
2107 return Key::template isIndexTargetOf<Cs::index_targets.size(), Cs::index_targets>();
2108 } else {
2109 return false;
2110 }
2111 }()...};
2113 constexpr auto pos = std::find(map.begin(), map.end(), true);
2114 if constexpr (pos != map.end()) {
2115 return mColumnChunks[std::distance(map.begin(), pos)];
2116 } else {
2117 static_assert(framework::always_static_assert_v<Key>, "This table does not have an index to given Key");
2118 }
2119 }
2120
2122 {
2123 return mBegin;
2124 }
2125
2126 auto const& cached_begin() const
2127 {
2128 return mBegin;
2129 }
2130
2132 {
2133 return unfiltered_iterator(mBegin);
2134 }
2135
2137 {
2138 return RowViewSentinel{mEnd};
2139 }
2140
2141 filtered_iterator filtered_begin(std::span<int64_t const> selection)
2142 {
2143 // Note that the FilteredIndexPolicy will never outlive the selection which
2144 // is held by the table, so we are safe passing the bare pointer. If it does it
2145 // means that the iterator on a table is outliving the table itself, which is
2146 // a bad idea.
2147 return filtered_iterator(mColumnChunks, {selection, mTable->num_rows(), mOffset});
2148 }
2149
2150 iterator iteratorAt(uint64_t i) const
2151 {
2152 return rawIteratorAt(i);
2153 }
2154
2156 {
2157 auto it = mBegin;
2158 it.setCursor(i);
2159 return it;
2160 }
2161
2163 {
2164 return unfiltered_const_iterator(mBegin);
2165 }
2166
2167 [[nodiscard]] RowViewSentinel end() const
2168 {
2169 return RowViewSentinel{mEnd};
2170 }
2171
2173 [[nodiscard]] std::shared_ptr<arrow::Table> asArrowTable() const
2174 {
2175 return mTable;
2176 }
2178 auto offset() const
2179 {
2180 return mOffset;
2181 }
2183 [[nodiscard]] int64_t size() const
2184 {
2185 return mTable->num_rows();
2186 }
2187
2188 [[nodiscard]] int64_t tableSize() const
2189 {
2190 return size();
2191 }
2192
2195 template <typename... TA>
2196 void bindExternalIndices(TA*... current)
2197 {
2198 ([this](TA* cur) {
2199 if constexpr (binding_origin == TA::binding_origin) {
2200 mBegin.bindExternalIndex(cur);
2201 }
2202 }(current),
2203 ...);
2204 }
2205
2206 template <typename TA>
2207 void bindExternalIndex(TA* current)
2208 {
2209 mBegin.bindExternalIndex(current); // unchecked binding for the derived tables
2210 }
2211
2212 template <typename I>
2214 {
2215 mBegin.bindInternalIndices(ptr);
2216 }
2217
2222
2223 template <typename... Cs>
2225 {
2226 (static_cast<Cs>(mBegin).setCurrentRaw(binding), ...);
2227 }
2228
2229 void bindExternalIndicesRaw(std::vector<o2::soa::Binding>&& ptrs)
2230 {
2231 mBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
2232 }
2233
2234 template <typename T, typename... Cs>
2236 {
2237 dest.bindExternalIndicesRaw(mBegin.getIndexBindings());
2238 }
2239
2240 template <typename T>
2241 void copyIndexBindings(T& dest) const
2242 {
2244 }
2245
2247 {
2248 auto t = o2::soa::select(*this, f);
2250 return t;
2251 }
2252
2254 {
2255 return doSliceByCached(this, node, value, cache);
2256 }
2257
2262
2263 template <typename T1, typename Policy, bool OPT>
2265 {
2266 return doSliceBy(this, container, value);
2267 }
2268
2269 auto rawSlice(uint64_t start, uint64_t end) const
2270 {
2271 return self_t{mTable->Slice(start, end - start + 1), start};
2272 }
2273
2274 auto emptySlice() const
2275 {
2276 return self_t{mTable->Slice(0, 0), 0};
2277 }
2278
2279 private:
2280 template <typename T>
2281 arrow::ChunkedArray* lookupColumn()
2282 {
2283 if constexpr (soa::is_persistent_column<T>) {
2284 auto label = T::columnLabel();
2285 return getIndexFromLabel(mTable.get(), label);
2286 } else {
2287 return nullptr;
2288 }
2289 }
2290 std::shared_ptr<arrow::Table> mTable = nullptr;
2291 uint64_t mOffset = 0;
2292 // Cached pointers to the ChunkedArray associated to a column
2293 arrow::ChunkedArray* mColumnChunks[framework::pack_size(columns_t{})];
2294 RowViewSentinel mEnd;
2295 iterator mBegin;
2296};
2297
2298template <uint32_t D, soa::is_column... C>
2300
2301void getterNotFound(const char* targetColumnLabel);
2302void emptyColumnLabel();
2303
2304namespace row_helpers
2305{
2306template <typename R, typename T, typename C>
2307R getColumnValue(const T& rowIterator)
2308{
2309 return static_cast<R>(static_cast<C>(rowIterator).get());
2310}
2311
2312namespace
2313{
2314template <typename R, typename T>
2315using ColumnGetterFunction = R (*)(const T&);
2316
2317template <typename T, typename R>
2319 // lambda is callable without additional free args
2320 framework::pack_size(typename T::bindings_t{}) == framework::pack_size(typename T::callable_t::args{}) &&
2321 requires(T t) {
2322 { t.get() } -> std::convertible_to<R>;
2323 };
2324
2325template <typename T, typename R>
2326concept persistent_with_common_getter = is_persistent_v<T> && requires(T t) {
2327 { t.get() } -> std::convertible_to<R>;
2328};
2329
2330template <typename R, typename T, persistent_with_common_getter<R> C>
2331ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& targetColumnLabel)
2332{
2333 return targetColumnLabel == C::columnLabel() ? &getColumnValue<R, T, C> : nullptr;
2334}
2335
2336template <typename R, typename T, dynamic_with_common_getter<R> C>
2337ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& targetColumnLabel)
2338{
2339 std::string_view columnLabel(C::columnLabel());
2340
2341 // allows user to use consistent formatting (with prefix) of all column labels
2342 // by default there isn't 'f' prefix for dynamic column labels
2343 if (targetColumnLabel.starts_with("f") && targetColumnLabel.substr(1) == columnLabel) {
2344 return &getColumnValue<R, T, C>;
2345 }
2346
2347 // check also exact match if user is aware of prefix missing
2348 if (targetColumnLabel == columnLabel) {
2349 return &getColumnValue<R, T, C>;
2350 }
2351
2352 return nullptr;
2353}
2354
2355template <typename R, typename T, typename... Cs>
2356ColumnGetterFunction<R, T> getColumnGetterByLabel(o2::framework::pack<Cs...>, const std::string_view& targetColumnLabel)
2357{
2358 ColumnGetterFunction<R, T> func;
2359
2360 (void)((func = createGetterPtr<R, T, Cs>(targetColumnLabel), func) || ...);
2361
2362 if (!func) {
2363 getterNotFound(targetColumnLabel.data());
2364 }
2365
2366 return func;
2367}
2368
2369template <typename T, typename R>
2370using with_common_getter_t = typename std::conditional<persistent_with_common_getter<T, R> || dynamic_with_common_getter<T, R>, std::true_type, std::false_type>::type;
2371} // namespace
2372
2373template <typename R, typename T>
2374ColumnGetterFunction<R, typename T::iterator> getColumnGetterByLabel(const std::string_view& targetColumnLabel)
2375{
2376 using TypesWithCommonGetter = o2::framework::selected_pack_multicondition<with_common_getter_t, framework::pack<R>, typename T::columns_t>;
2377
2378 if (targetColumnLabel.size() == 0) {
2380 }
2381
2382 return getColumnGetterByLabel<R, typename T::iterator>(TypesWithCommonGetter{}, targetColumnLabel);
2383}
2384} // namespace row_helpers
2385} // namespace o2::soa
2386
2387namespace o2::aod
2388{
2389// If you get an error about not satisfying is_origin_hash, you need to add
2390// an entry here.
2392O2ORIGIN("AOD1");
2393O2ORIGIN("AOD2");
2394// O2ORIGIN("DYN");
2395// O2ORIGIN("IDX");
2396// O2ORIGIN("ATIM");
2397O2ORIGIN("JOIN");
2398O2HASH("JOIN/0");
2399O2ORIGIN("CONC");
2400O2HASH("CONC/0");
2401O2ORIGIN("TEST");
2402O2HASH("TEST/0");
2403} // namespace o2::aod
2404
2405namespace
2406{
2407template <typename T>
2408consteval static std::string_view namespace_prefix()
2409{
2410 constexpr auto name = o2::framework::type_name<T>();
2411 const auto pos = name.rfind(std::string_view{":"});
2412 return name.substr(0, pos + 1);
2413}
2414} // namespace
2415
2416#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \
2417 template <> \
2418 struct EquivalentIndexNG<o2::aod::Hash<_Base_::ref.desc_hash>, o2::aod::Hash<_Equiv_::ref.desc_hash>> { \
2419 constexpr static bool value = true; \
2420 }
2421
2422#define DECLARE_EQUIVALENT_FOR_INDEX_NG(_Base_, _Equiv_) \
2423 template <> \
2424 struct EquivalentIndexNG<o2::aod::Hash<_Base_ ""_h>, o2::aod::Hash<_Equiv_ ""_h>> { \
2425 constexpr static bool value = true; \
2426 }
2427
2428#define DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
2429 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2430 static constexpr const char* mLabel = _Label_; \
2431 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2432 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2433 using base = o2::soa::Column<_Type_, _Name_>; \
2434 using type = _Type_; \
2435 using column_t = _Name_; \
2436 _Name_(arrow::ChunkedArray const* column) \
2437 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2438 { \
2439 } \
2440 \
2441 _Name_() = default; \
2442 _Name_(_Name_ const& other) = default; \
2443 _Name_& operator=(_Name_ const& other) = default; \
2444 \
2445 decltype(auto) _Getter_() const \
2446 { \
2447 return *mColumnIterator; \
2448 } \
2449 \
2450 decltype(auto) get() const \
2451 { \
2452 return _Getter_(); \
2453 } \
2454 }; \
2455 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2456
2457#define DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2458 struct _Name_ : o2::soa::Column<std::span<std::byte>, _Name_> { \
2459 static constexpr const char* mLabel = _Label_; \
2460 static constexpr const char* query = _CCDBQuery_; \
2461 static constexpr const uint32_t hash = crc32(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2462 using base = o2::soa::Column<std::span<std::byte>, _Name_>; \
2463 using type = std::span<std::byte>; \
2464 using column_t = _Name_; \
2465 _Name_(arrow::ChunkedArray const* column) \
2466 : o2::soa::Column<std::span<std::byte>, _Name_>(o2::soa::ColumnIterator<std::span<std::byte>>(column)) \
2467 { \
2468 } \
2469 \
2470 _Name_() = default; \
2471 _Name_(_Name_ const& other) = default; \
2472 _Name_& operator=(_Name_ const& other) = default; \
2473 \
2474 decltype(auto) _Getter_() const \
2475 { \
2476 if constexpr (std::same_as<_ConcreteType_, std::span<std::byte>>) { \
2477 return *mColumnIterator; \
2478 } else { \
2479 static std::byte* payload = nullptr; \
2480 static _ConcreteType_* deserialised = nullptr; \
2481 static TClass* c = TClass::GetClass(#_ConcreteType_); \
2482 auto span = *mColumnIterator; \
2483 if (payload != (std::byte*)span.data()) { \
2484 payload = (std::byte*)span.data(); \
2485 delete deserialised; \
2486 TBufferFile f(TBufferFile::EMode::kRead, span.size(), (char*)span.data(), kFALSE); \
2487 deserialised = (_ConcreteType_*)soa::extractCCDBPayload((char*)payload, span.size(), c, "ccdb_object"); \
2488 } \
2489 return *deserialised; \
2490 } \
2491 } \
2492 \
2493 decltype(auto) \
2494 get() const \
2495 { \
2496 return _Getter_(); \
2497 } \
2498 };
2499
2500#define DECLARE_SOA_CCDB_COLUMN(_Name_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2501 DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, "f" #_Name_, _Getter_, _ConcreteType_, _CCDBQuery_)
2502
2503#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_) \
2504 DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_)
2505
2508#define MAKEINT(_Size_) uint##_Size_##_t
2509
2510#define DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, _Label_) \
2511 struct _Name_ : o2::soa::Column<MAKEINT(_Size_), _Name_> { \
2512 static constexpr const char* mLabel = _Label_; \
2513 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2514 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2515 using base = o2::soa::Column<MAKEINT(_Size_), _Name_>; \
2516 using type = MAKEINT(_Size_); \
2517 _Name_(arrow::ChunkedArray const* column) \
2518 : o2::soa::Column<type, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2519 { \
2520 } \
2521 \
2522 _Name_() = default; \
2523 _Name_(_Name_ const& other) = default; \
2524 _Name_& operator=(_Name_ const& other) = default; \
2525 \
2526 decltype(auto) _Getter_##_raw() const \
2527 { \
2528 return *mColumnIterator; \
2529 } \
2530 \
2531 bool _Getter_##_bit(int bit) const \
2532 { \
2533 return (*mColumnIterator & (static_cast<type>(1) << bit)) >> bit; \
2534 } \
2535 }; \
2536 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<MAKEINT(_Size_)>() }
2537
2538#define DECLARE_SOA_BITMAP_COLUMN(_Name_, _Getter_, _Size_) \
2539 DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, "f" #_Name_)
2540
2543#define DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_, _Expression_) \
2544 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2545 static constexpr const char* mLabel = _Label_; \
2546 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2547 using base = o2::soa::Column<_Type_, _Name_>; \
2548 using type = _Type_; \
2549 using column_t = _Name_; \
2550 using spawnable_t = std::true_type; \
2551 _Name_(arrow::ChunkedArray const* column) \
2552 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2553 { \
2554 } \
2555 \
2556 _Name_() = default; \
2557 _Name_(_Name_ const& other) = default; \
2558 _Name_& operator=(_Name_ const& other) = default; \
2559 \
2560 decltype(auto) _Getter_() const \
2561 { \
2562 return *mColumnIterator; \
2563 } \
2564 \
2565 decltype(auto) get() const \
2566 { \
2567 return _Getter_(); \
2568 } \
2569 \
2570 static o2::framework::expressions::Projector Projector() \
2571 { \
2572 return _Expression_; \
2573 } \
2574 }; \
2575 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2576
2577#define DECLARE_SOA_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Expression_) \
2578 DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_, _Expression_);
2579
2582#define DECLARE_SOA_CONFIGURABLE_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Label_) \
2583 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2584 static constexpr const char* mLabel = _Label_; \
2585 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2586 static constexpr const int32_t mHash = _Label_ ""_h; \
2587 using base = o2::soa::Column<_Type_, _Name_>; \
2588 using type = _Type_; \
2589 using column_t = _Name_; \
2590 using spawnable_t = std::true_type; \
2591 _Name_(arrow::ChunkedArray const* column) \
2592 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2593 { \
2594 } \
2595 \
2596 _Name_() = default; \
2597 _Name_(_Name_ const& other) = default; \
2598 _Name_& operator=(_Name_ const& other) = default; \
2599 \
2600 decltype(auto) _Getter_() const \
2601 { \
2602 return *mColumnIterator; \
2603 } \
2604 \
2605 decltype(auto) get() const \
2606 { \
2607 return _Getter_(); \
2608 } \
2609 }; \
2610 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2611
2630
2632
2633template <o2::soa::is_table T>
2634consteval auto getIndexTargets()
2635{
2636 return T::originals;
2637}
2638
2639#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2640 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2641 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2642 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2643 static constexpr const char* mLabel = "fIndexSlice" _Label_ _Suffix_; \
2644 static constexpr const uint32_t hash = 0; \
2645 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2646 using type = _Type_[2]; \
2647 using column_t = _Name_##IdSlice; \
2648 using binding_t = _Table_; \
2649 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2650 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2651 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2652 { \
2653 } \
2654 \
2655 _Name_##IdSlice() = default; \
2656 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2657 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2658 std::array<_Type_, 2> inline getIds() const \
2659 { \
2660 return _Getter_##Ids(); \
2661 } \
2662 \
2663 bool has_##_Getter_() const \
2664 { \
2665 auto a = *mColumnIterator; \
2666 return a[0] >= 0 && a[1] >= 0; \
2667 } \
2668 \
2669 std::array<_Type_, 2> _Getter_##Ids() const \
2670 { \
2671 auto a = *mColumnIterator; \
2672 return std::array{a[0], a[1]}; \
2673 } \
2674 \
2675 template <typename T> \
2676 auto _Getter_##_as() const \
2677 { \
2678 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2679 o2::soa::notBoundTable(#_Table_); \
2680 } \
2681 auto t = mBinding.get<T>(); \
2682 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2683 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2684 } \
2685 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2686 return t->emptySlice(); \
2687 } \
2688 auto a = *mColumnIterator; \
2689 auto r = t->rawSlice(a[0], a[1]); \
2690 t->copyIndexBindings(r); \
2691 r.bindInternalIndicesTo(t); \
2692 return r; \
2693 } \
2694 \
2695 auto _Getter_() const \
2696 { \
2697 return _Getter_##_as<binding_t>(); \
2698 } \
2699 \
2700 template <typename T> \
2701 bool setCurrent(T const* current) \
2702 { \
2703 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2704 assert(current != nullptr); \
2705 this->mBinding.bind(current); \
2706 return true; \
2707 } \
2708 return false; \
2709 } \
2710 \
2711 bool setCurrentRaw(o2::soa::Binding current) \
2712 { \
2713 this->mBinding = current; \
2714 return true; \
2715 } \
2716 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2717 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2718 o2::soa::Binding mBinding; \
2719 };
2720
2721#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2722#define DECLARE_SOA_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2723#define DECLARE_SOA_SLICE_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2724
2726#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2727 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
2728 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2729 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2730 static constexpr const char* mLabel = "fIndexArray" _Label_ _Suffix_; \
2731 static constexpr const uint32_t hash = 0; \
2732 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
2733 using type = std::vector<_Type_>; \
2734 using column_t = _Name_##Ids; \
2735 using binding_t = _Table_; \
2736 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2737 _Name_##Ids(arrow::ChunkedArray const* column) \
2738 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
2739 { \
2740 } \
2741 \
2742 _Name_##Ids() = default; \
2743 _Name_##Ids(_Name_##Ids const& other) = default; \
2744 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
2745 \
2746 gsl::span<const _Type_> inline getIds() const \
2747 { \
2748 return _Getter_##Ids(); \
2749 } \
2750 \
2751 gsl::span<const _Type_> _Getter_##Ids() const \
2752 { \
2753 return *mColumnIterator; \
2754 } \
2755 \
2756 bool has_##_Getter_() const \
2757 { \
2758 return !(*mColumnIterator).empty(); \
2759 } \
2760 \
2761 template <soa::is_table T> \
2762 auto _Getter_##_as() const \
2763 { \
2764 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2765 o2::soa::notBoundTable(#_Table_); \
2766 } \
2767 auto t = mBinding.get<T>(); \
2768 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2769 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2770 } \
2771 auto result = std::vector<typename T::unfiltered_iterator>(); \
2772 result.reserve((*mColumnIterator).size()); \
2773 for (auto& i : *mColumnIterator) { \
2774 result.emplace_back(t->rawIteratorAt(i)); \
2775 } \
2776 return result; \
2777 } \
2778 \
2779 template <soa::is_filtered_table T> \
2780 auto filtered_##_Getter_##_as() const \
2781 { \
2782 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2783 o2::soa::notBoundTable(#_Table_); \
2784 } \
2785 auto t = mBinding.get<T>(); \
2786 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2787 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2788 } \
2789 auto result = std::vector<typename T::iterator>(); \
2790 result.reserve((*mColumnIterator).size()); \
2791 for (auto const& i : *mColumnIterator) { \
2792 auto pos = t->isInSelectedRows(i); \
2793 if (pos > 0) { \
2794 result.emplace_back(t->iteratorAt(pos)); \
2795 } \
2796 } \
2797 return result; \
2798 } \
2799 \
2800 auto _Getter_() const \
2801 { \
2802 return _Getter_##_as<binding_t>(); \
2803 } \
2804 \
2805 template <typename T> \
2806 auto _Getter_##_first_as() const \
2807 { \
2808 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2809 o2::soa::notBoundTable(#_Table_); \
2810 } \
2811 auto t = mBinding.get<T>(); \
2812 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2813 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2814 } \
2815 return t->rawIteratorAt((*mColumnIterator)[0]); \
2816 } \
2817 \
2818 template <typename T> \
2819 auto _Getter_##_last_as() const \
2820 { \
2821 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2822 o2::soa::notBoundTable(#_Table_); \
2823 } \
2824 auto t = mBinding.get<T>(); \
2825 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2826 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2827 } \
2828 return t->rawIteratorAt((*mColumnIterator).back()); \
2829 } \
2830 \
2831 auto _Getter_first() const \
2832 { \
2833 return _Getter_##_first_as<binding_t>(); \
2834 } \
2835 \
2836 auto _Getter_last() const \
2837 { \
2838 return _Getter_##_last_as<binding_t>(); \
2839 } \
2840 \
2841 template <typename T> \
2842 bool setCurrent(T const* current) \
2843 { \
2844 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2845 assert(current != nullptr); \
2846 this->mBinding.bind(current); \
2847 return true; \
2848 } \
2849 return false; \
2850 } \
2851 \
2852 bool setCurrentRaw(o2::soa::Binding current) \
2853 { \
2854 this->mBinding = current; \
2855 return true; \
2856 } \
2857 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2858 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2859 o2::soa::Binding mBinding; \
2860 };
2861
2862#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2863#define DECLARE_SOA_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2864#define DECLARE_SOA_ARRAY_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2865
2867#define DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2868 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2869 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2870 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2871 static constexpr const char* mLabel = "fIndex" _Label_ _Suffix_; \
2872 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2873 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2874 using type = _Type_; \
2875 using column_t = _Name_##Id; \
2876 using binding_t = _Table_; \
2877 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2878 _Name_##Id(arrow::ChunkedArray const* column) \
2879 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2880 { \
2881 } \
2882 \
2883 _Name_##Id() = default; \
2884 _Name_##Id(_Name_##Id const& other) = default; \
2885 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2886 type inline getId() const \
2887 { \
2888 return _Getter_##Id(); \
2889 } \
2890 \
2891 type _Getter_##Id() const \
2892 { \
2893 return *mColumnIterator; \
2894 } \
2895 \
2896 bool has_##_Getter_() const \
2897 { \
2898 return *mColumnIterator >= 0; \
2899 } \
2900 \
2901 template <typename T> \
2902 auto _Getter_##_as() const \
2903 { \
2904 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2905 o2::soa::notBoundTable(#_Table_); \
2906 } \
2907 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2908 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2909 } \
2910 auto t = mBinding.get<T>(); \
2911 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2912 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2913 } \
2914 return t->rawIteratorAt(*mColumnIterator); \
2915 } \
2916 \
2917 auto _Getter_() const \
2918 { \
2919 return _Getter_##_as<binding_t>(); \
2920 } \
2921 \
2922 template <typename T> \
2923 bool setCurrent(T* current) \
2924 { \
2925 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2926 assert(current != nullptr); \
2927 this->mBinding.bind(current); \
2928 return true; \
2929 } \
2930 return false; \
2931 } \
2932 \
2933 bool setCurrentRaw(o2::soa::Binding current) \
2934 { \
2935 this->mBinding = current; \
2936 return true; \
2937 } \
2938 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2939 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2940 o2::soa::Binding mBinding; \
2941 }; \
2942 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_ _Suffix_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2943
2944#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2945#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2946#define DECLARE_SOA_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2947
2949#define DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2950 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2951 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2952 static constexpr const char* mLabel = "fIndex" _Label_; \
2953 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2954 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2955 using type = _Type_; \
2956 using column_t = _Name_##Id; \
2957 using self_index_t = std::true_type; \
2958 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2959 _Name_##Id(arrow::ChunkedArray const* column) \
2960 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2961 { \
2962 } \
2963 \
2964 _Name_##Id() = default; \
2965 _Name_##Id(_Name_##Id const& other) = default; \
2966 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2967 type inline getId() const \
2968 { \
2969 return _Getter_##Id(); \
2970 } \
2971 \
2972 type _Getter_##Id() const \
2973 { \
2974 return *mColumnIterator; \
2975 } \
2976 \
2977 bool has_##_Getter_() const \
2978 { \
2979 return *mColumnIterator >= 0; \
2980 } \
2981 \
2982 template <typename T> \
2983 auto _Getter_##_as() const \
2984 { \
2985 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2986 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2987 } \
2988 auto t = mBinding.get<T>(); \
2989 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2990 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2991 } \
2992 return t->rawIteratorAt(*mColumnIterator); \
2993 } \
2994 \
2995 bool setCurrentRaw(o2::soa::Binding current) \
2996 { \
2997 this->mBinding = current; \
2998 return true; \
2999 } \
3000 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3001 o2::soa::Binding mBinding; \
3002 }; \
3003 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
3004
3005#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3006#define DECLARE_SOA_SELF_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
3008#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
3009 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
3010 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
3011 static constexpr const char* mLabel = "fIndexSlice" _Label_; \
3012 static constexpr const uint32_t hash = 0; \
3013 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
3014 using type = _Type_[2]; \
3015 using column_t = _Name_##IdSlice; \
3016 using self_index_t = std::true_type; \
3017 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
3018 _Name_##IdSlice(arrow::ChunkedArray const* column) \
3019 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
3020 { \
3021 } \
3022 \
3023 _Name_##IdSlice() = default; \
3024 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
3025 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
3026 std::array<_Type_, 2> inline getIds() const \
3027 { \
3028 return _Getter_##Ids(); \
3029 } \
3030 \
3031 bool has_##_Getter_() const \
3032 { \
3033 auto a = *mColumnIterator; \
3034 return a[0] >= 0 && a[1] >= 0; \
3035 } \
3036 \
3037 std::array<_Type_, 2> _Getter_##Ids() const \
3038 { \
3039 auto a = *mColumnIterator; \
3040 return std::array{a[0], a[1]}; \
3041 } \
3042 \
3043 template <typename T> \
3044 auto _Getter_##_as() const \
3045 { \
3046 auto t = mBinding.get<T>(); \
3047 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3048 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3049 } \
3050 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
3051 return t->emptySlice(); \
3052 } \
3053 auto a = *mColumnIterator; \
3054 auto r = t->rawSlice(a[0], a[1]); \
3055 t->copyIndexBindings(r); \
3056 r.bindInternalIndicesTo(t); \
3057 return r; \
3058 } \
3059 \
3060 bool setCurrentRaw(o2::soa::Binding current) \
3061 { \
3062 this->mBinding = current; \
3063 return true; \
3064 } \
3065 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3066 o2::soa::Binding mBinding; \
3067 };
3068
3069#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3070#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3072#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
3073 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
3074 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
3075 static constexpr const char* mLabel = "fIndexArray" _Label_; \
3076 static constexpr const uint32_t hash = 0; \
3077 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
3078 using type = std::vector<_Type_>; \
3079 using column_t = _Name_##Ids; \
3080 using self_index_t = std::true_type; \
3081 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
3082 _Name_##Ids(arrow::ChunkedArray const* column) \
3083 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
3084 { \
3085 } \
3086 \
3087 _Name_##Ids() = default; \
3088 _Name_##Ids(_Name_##Ids const& other) = default; \
3089 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
3090 gsl::span<const _Type_> inline getIds() const \
3091 { \
3092 return _Getter_##Ids(); \
3093 } \
3094 \
3095 gsl::span<const _Type_> _Getter_##Ids() const \
3096 { \
3097 return *mColumnIterator; \
3098 } \
3099 \
3100 bool has_##_Getter_() const \
3101 { \
3102 return !(*mColumnIterator).empty(); \
3103 } \
3104 \
3105 template <typename T> \
3106 auto _Getter_##_as() const \
3107 { \
3108 auto t = mBinding.get<T>(); \
3109 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3110 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3111 } \
3112 auto result = std::vector<typename T::unfiltered_iterator>(); \
3113 for (auto& i : *mColumnIterator) { \
3114 result.push_back(t->rawIteratorAt(i)); \
3115 } \
3116 return result; \
3117 } \
3118 \
3119 template <typename T> \
3120 auto _Getter_##_first_as() const \
3121 { \
3122 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator)[0]); \
3123 } \
3124 \
3125 template <typename T> \
3126 auto _Getter_##_last_as() const \
3127 { \
3128 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator).back()); \
3129 } \
3130 \
3131 bool setCurrentRaw(o2::soa::Binding current) \
3132 { \
3133 this->mBinding = current; \
3134 return true; \
3135 } \
3136 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3137 o2::soa::Binding mBinding; \
3138 };
3139
3140#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3141#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3142
3171#define DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_, ...) \
3172 struct _Name_##Callback { \
3173 static inline constexpr auto getLambda() { return __VA_ARGS__; } \
3174 }; \
3175 \
3176 struct _Name_##Helper { \
3177 using callable_t = decltype(o2::framework::FunctionMetadata(std::declval<decltype(_Name_##Callback::getLambda())>())); \
3178 using return_type = typename callable_t::return_type; \
3179 }; \
3180 template <typename... Bindings> \
3181 struct _Name_ : o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>> { \
3182 using base = o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>>; \
3183 using helper = _Name_##Helper; \
3184 using callback_holder_t = _Name_##Callback; \
3185 using callable_t = helper::callable_t; \
3186 using callback_t = callable_t::type; \
3187 static constexpr const uint32_t hash = 0; \
3188 \
3189 _Name_(arrow::ChunkedArray const*) \
3190 { \
3191 } \
3192 _Name_() = default; \
3193 _Name_(_Name_ const& other) = default; \
3194 _Name_& operator=(_Name_ const& other) = default; \
3195 static constexpr const char* mLabel = #_Name_; \
3196 using type = typename callable_t::return_type; \
3197 \
3198 template <typename... FreeArgs> \
3199 type _Getter_(FreeArgs... freeArgs) const \
3200 { \
3201 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3202 } \
3203 template <typename... FreeArgs> \
3204 type getDynamicValue(FreeArgs... freeArgs) const \
3205 { \
3206 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3207 } \
3208 \
3209 type get() const \
3210 { \
3211 return _Getter_(); \
3212 } \
3213 \
3214 template <size_t... Is, typename... FreeArgs> \
3215 type boundGetter(std::integer_sequence<size_t, Is...>&&, FreeArgs... freeArgs) const \
3216 { \
3217 return __VA_ARGS__((**std::get<Is>(boundIterators))..., freeArgs...); \
3218 } \
3219 \
3220 using bindings_t = typename o2::framework::pack<Bindings...>; \
3221 std::tuple<o2::soa::ColumnIterator<typename Bindings::type> const*...> boundIterators; \
3222 }
3223
3224#define DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, ...) \
3225 using _Name_##Metadata = TableMetadata<Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__>;
3226
3227#define DECLARE_SOA_TABLE_METADATA_TRAIT(_Name_, _Desc_, _Version_) \
3228 template <> \
3229 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3230 using metadata = _Name_##Metadata; \
3231 };
3232
3233#define DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_) \
3234 O2HASH(_Desc_ "/" #_Version_); \
3235 template <typename O> \
3236 using _Name_##From = o2::soa::Table<Hash<_Label_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3237 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>; \
3238 template <> \
3239 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3240 using metadata = _Name_##Metadata; \
3241 };
3242
3243#define DECLARE_SOA_STAGE(_Name_, _Origin_, _Desc_, _Version_) \
3244 template <typename O> \
3245 using _Name_##From = o2::soa::Table<Hash<#_Name_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3246 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>;
3247
3248#define DECLARE_SOA_TABLE_FULL_VERSIONED(_Name_, _Label_, _Origin_, _Desc_, _Version_, ...) \
3249 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3250 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_);
3251
3252#define DECLARE_SOA_TABLE_FULL(_Name_, _Label_, _Origin_, _Desc_, ...) \
3253 O2HASH(_Label_); \
3254 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, 0, __VA_ARGS__); \
3255 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, 0)
3256
3257#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_, ...) \
3258 DECLARE_SOA_TABLE_FULL(_Name_, #_Name_, _Origin_, _Desc_, __VA_ARGS__)
3259
3260#define DECLARE_SOA_TABLE_VERSIONED(_Name_, _Origin_, _Desc_, _Version_, ...) \
3261 O2HASH(#_Name_); \
3262 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3263 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, #_Name_, _Origin_, _Desc_, _Version_)
3264
3265#define DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, _Version_, ...) \
3266 O2HASH(_Desc_ "/" #_Version_); \
3267 O2HASH(#_BaseName_); \
3268 O2HASH("Stored" #_BaseName_); \
3269 DECLARE_SOA_TABLE_METADATA(_BaseName_, _Desc_, _Version_, __VA_ARGS__); \
3270 using Stored##_BaseName_##Metadata = _BaseName_##Metadata; \
3271 DECLARE_SOA_TABLE_METADATA_TRAIT(_BaseName_, _Desc_, _Version_); \
3272 DECLARE_SOA_STAGE(_BaseName_, "AOD", _Desc_, _Version_); \
3273 DECLARE_SOA_STAGE(Stored##_BaseName_, "AOD1", _Desc_, _Version_);
3274
3275#define DECLARE_SOA_TABLE_STAGED(_BaseName_, _Desc_, ...) \
3276 DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, 0, __VA_ARGS__);
3277
3278#define DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3279 O2HASH(_Desc_ "/" #_Version_); \
3280 O2HASH(#_Name_ "Extension"); \
3281 template <typename O> \
3282 using _Name_##ExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "Extension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3283 using _Name_##Extension = _Name_##ExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3284 struct _Name_##ExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3285 using base_table_t = _OriginalTable_; \
3286 template <o2::aod::is_origin_hash O> \
3287 using extension_table_t_from = _Name_##ExtensionFrom<O>; \
3288 using extension_table_t = _Name_##Extension; \
3289 using expression_pack_t = framework::pack<__VA_ARGS__>; \
3290 static constexpr auto N = _OriginalTable_::originals.size(); \
3291 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3292 static consteval auto generateSources() \
3293 { \
3294 return _OriginalTable_##From<O>::originals; \
3295 } \
3296 }; \
3297 template <> \
3298 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3299 using metadata = _Name_##ExtensionMetadata; \
3300 }; \
3301 template <typename O> \
3302 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##ExtensionFrom<O>>; \
3303 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3304
3305#define DECLARE_SOA_EXTENDED_TABLE(_Name_, _Table_, _Description_, _Version_, ...) \
3306 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, _Description_, _Version_, __VA_ARGS__)
3307
3308#define DECLARE_SOA_EXTENDED_TABLE_USER(_Name_, _Table_, _Description_, ...) \
3309 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, "EX" _Description_, 0, __VA_ARGS__)
3310
3311#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3312 O2HASH(_Desc_ "/" #_Version_); \
3313 O2HASH(#_Name_ "CfgExtension"); \
3314 template <typename O> \
3315 using _Name_##CfgExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "CfgExtension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3316 using _Name_##CfgExtension = _Name_##CfgExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3317 struct _Name_##CfgExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3318 using base_table_t = _OriginalTable_; \
3319 template <o2::aod::is_origin_hash O> \
3320 using extension_table_t_from = _Name_##CfgExtensionFrom<O>; \
3321 using extension_table_t = _Name_##CfgExtension; \
3322 using placeholders_pack_t = framework::pack<__VA_ARGS__>; \
3323 using configurable_t = std::true_type; \
3324 static constexpr auto N = _OriginalTable_::originals.size(); \
3325 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3326 static consteval auto generateSources() \
3327 { \
3328 return _OriginalTable_##From<O>::originals; \
3329 } \
3330 }; \
3331 template <> \
3332 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3333 using metadata = _Name_##CfgExtensionMetadata; \
3334 }; \
3335 template <typename O> \
3336 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##CfgExtensionFrom<O>>; \
3337 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3338
3339#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE(_Name_, _OriginalTable_, _Description_, ...) \
3340 DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, "EX" _Description_, 0, __VA_ARGS__)
3341
3342#define DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, _Version_, _Desc_, _Exclusive_, ...) \
3343 O2HASH(#_Name_); \
3344 O2HASH(_Desc_ "/" #_Version_); \
3345 struct _Name_##Metadata : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3346 static constexpr bool exclusive = _Exclusive_; \
3347 template <o2::aod::is_origin_hash O> \
3348 using KeyFrom = _Key_##From<O>; \
3349 using Key = _Key_; \
3350 using index_pack_t = framework::pack<__VA_ARGS__>; \
3351 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3352 static consteval auto generateSources() \
3353 { \
3354 return []<soa::is_index_column... Cs>(framework::pack<Cs...>) { \
3355 constexpr auto first = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3356 constexpr auto second = o2::aod::filterForKey<first.size(), first, Key>(); \
3357 return o2::aod::replaceOrigin<second.size(), second, O>(); \
3358 }(framework::pack<__VA_ARGS__>{}); \
3359 } \
3360 static constexpr auto N = []<typename... Cs>(framework::pack<Cs...>) { \
3361 constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3362 return o2::aod::filterForKey<a.size(), a, Key>(); \
3363 }(framework::pack<__VA_ARGS__>{}) \
3364 .size(); \
3365 }; \
3366 template <> \
3367 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3368 using metadata = _Name_##Metadata; \
3369 }; \
3370 template <o2::aod::is_origin_hash O> \
3371 using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_##From<O>, __VA_ARGS__>; \
3372 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3373
3374#define DECLARE_SOA_INDEX_TABLE(_Name_, _Key_, _Description_, ...) \
3375 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3376
3377#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE(_Name_, _Key_, _Description_, ...) \
3378 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3379
3380#define DECLARE_SOA_INDEX_TABLE_USER(_Name_, _Key_, _Description_, ...) \
3381 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3382
3383#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE_USER(_Name_, _Key_, _Description_, ...) \
3384 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3385
3386// Declare were each row is associated to a timestamp column of an _TimestampSource_
3387// table.
3388//
3389// The columns of this table have to be CCDB_COLUMNS so that for each timestamp, we get a row
3390// which points to the specified CCDB objectes described by those columns.
3391#define DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, _Label_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, ...) \
3392 O2HASH(_Desc_ "/" #_Version_); \
3393 template <typename O> \
3394 using _Name_##TimestampFrom = soa::Table<o2::aod::Hash<_Label_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3395 using _Name_##Timestamp = _Name_##TimestampFrom<o2::aod::Hash< \
3396 "AOD" \
3397 ""_h>>; \
3398 struct _Name_##TimestampMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3399 template <typename O = o2::aod::Hash<"AOD" \
3400 ""_h>> \
3401 using base_table_t = _TimestampSource_##From<O>; \
3402 template <typename O = o2::aod::Hash<"AOD" \
3403 ""_h>> \
3404 using extension_table_t = _Name_##TimestampFrom<O>; \
3405 static constexpr const auto ccdb_urls = []<typename... Cs>(framework::pack<Cs...>) { \
3406 return std::array<std::string_view, sizeof...(Cs)>{Cs::query...}; \
3407 }(framework::pack<__VA_ARGS__>{}); \
3408 static constexpr const auto ccdb_bindings = []<typename... Cs>(framework::pack<Cs...>) { \
3409 return std::array<std::string_view, sizeof...(Cs)>{Cs::mLabel...}; \
3410 }(framework::pack<__VA_ARGS__>{}); \
3411 static constexpr auto N = _TimestampSource_::originals.size(); \
3412 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3413 static consteval auto generateSources() \
3414 { \
3415 return _TimestampSource_##From<O>::originals; \
3416 } \
3417 static constexpr auto timestamp_column_label = _TimestampColumn_::mLabel; \
3418 /*static constexpr auto timestampColumn = _TimestampColumn_;*/ \
3419 }; \
3420 template <> \
3421 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3422 using metadata = _Name_##TimestampMetadata; \
3423 }; \
3424 template <typename O> \
3425 using _Name_##From = o2::soa::Join<_TimestampSource_, _Name_##TimestampFrom<O>>; \
3426 using _Name_ = _Name_##From<o2::aod::Hash< \
3427 "AOD" \
3428 ""_h>>;
3429
3430#define DECLARE_SOA_TIMESTAMPED_TABLE(_Name_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, ...) \
3431 O2HASH(#_Name_ "Timestamped"); \
3432 DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, #_Name_ "Timestamped", _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, __VA_ARGS__)
3433
3434namespace o2::soa
3435{
3436template <typename... Ts>
3437struct Join : Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Ts...> {
3438 using base = Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Ts...>;
3439
3440 Join(std::shared_ptr<arrow::Table>&& table, uint64_t offset = 0)
3441 : base{std::move(table), offset}
3442 {
3443 if (this->tableSize() != 0) {
3445 }
3446 }
3447 Join(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
3448 : base{ArrowHelpers::joinTables(std::move(tables), std::span{base::originalLabels}), offset}
3449 {
3450 if (this->tableSize() != 0) {
3452 }
3453 }
3456 static constexpr const uint32_t binding_origin = base::binding_origin;
3458
3459 template <typename... TA>
3460 void bindExternalIndices(TA*... current)
3461 {
3462 ([this](TA* cur) {
3463 if constexpr (binding_origin == TA::binding_origin) {
3464 this->bindExternalIndex(cur);
3465 }
3466 }(current),
3467 ...);
3468 }
3469
3470 using self_t = Join<Ts...>;
3471 using table_t = base;
3472 static constexpr const auto originals = base::originals;
3473 static constexpr const auto originalLabels = base::originalLabels;
3476 using iterator = table_t::template iterator_template<DefaultIndexPolicy, self_t, Ts...>;
3482
3484 {
3485 return iterator{this->cached_begin()};
3486 }
3487
3489 {
3490 return const_iterator{this->cached_begin()};
3491 }
3492
3494 {
3495 return doSliceByCached(this, node, value, cache);
3496 }
3497
3502
3503 template <typename T1, typename Policy, bool OPT>
3505 {
3506 return doSliceBy(this, container, value);
3507 }
3508
3509 iterator rawIteratorAt(uint64_t i) const
3510 {
3511 auto it = iterator{this->cached_begin()};
3512 it.setCursor(i);
3513 return it;
3514 }
3515
3516 iterator iteratorAt(uint64_t i) const
3517 {
3518 return rawIteratorAt(i);
3519 }
3520
3521 auto rawSlice(uint64_t start, uint64_t end) const
3522 {
3523 return self_t{{this->asArrowTable()->Slice(start, end - start + 1)}, start};
3524 }
3525
3526 auto emptySlice() const
3527 {
3528 return self_t{{this->asArrowTable()->Slice(0, 0)}, 0};
3529 }
3530
3531 template <typename T>
3532 static consteval bool contains()
3533 {
3534 return []<size_t... Is>(std::index_sequence<Is...>) {
3535 return (std::ranges::any_of(originals, [](TableRef const& ref) { return ref.desc_hash == T::originals[Is].desc_hash; }) && ...);
3536 }(std::make_index_sequence<T::originals.size()>());
3537 }
3538};
3539
3540template <typename... Ts>
3541constexpr auto join(Ts const&... t)
3542{
3543 return Join<Ts...>(ArrowHelpers::joinTables({t.asArrowTable()...}, std::span{Join<Ts...>::base::originalLabels}));
3544}
3545
3546template <typename T>
3548
3549template <typename T>
3550constexpr bool is_soa_join_v = is_join<T>;
3551
3552template <typename... Ts>
3553struct Concat : Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...> {
3554 using base = Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...>;
3555 using self_t = Concat<Ts...>;
3556 Concat(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
3557 : base{ArrowHelpers::concatTables(std::move(tables)), offset}
3558 {
3560 }
3561 Concat(Ts const&... t, uint64_t offset = 0)
3562 : base{ArrowHelpers::concatTables({t.asArrowTable()...}), offset}
3563 {
3564 bindInternalIndicesTo(this);
3565 }
3566
3567 using base::originals;
3568
3569 using base::bindExternalIndices;
3570 using base::bindInternalIndicesTo;
3571
3572 using table_t = base;
3575
3576 using iterator = table_t::template iterator_template<DefaultIndexPolicy, self_t, Ts...>;
3582};
3583
3584template <typename... Ts>
3585constexpr auto concat(Ts const&... t)
3586{
3587 return Concat<Ts...>{t...};
3588}
3589
3590template <soa::is_table T>
3591class FilteredBase : public T
3592{
3593 public:
3595 using table_t = typename T::table_t;
3596 using T::originals;
3597 static constexpr const uint32_t binding_origin = T::binding_origin;
3598 static constexpr const header::DataOrigin binding_origin_ = T::binding_origin_;
3599 template <typename... TA>
3600 void bindExternalIndices(TA*... current)
3601 {
3602 ([this](TA* cur) {
3603 if constexpr (binding_origin == TA::binding_origin) {
3604 this->bindExternalIndex(cur);
3605 mFilteredBegin.bindExternalIndex(cur);
3606 }
3607 }(current),
3608 ...);
3609 }
3610 using columns_t = typename T::columns_t;
3611 using persistent_columns_t = typename T::persistent_columns_t;
3612 using external_index_columns_t = typename T::external_index_columns_t;
3613
3614 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3615 using unfiltered_iterator = T::template iterator_template_o<DefaultIndexPolicy, self_t>;
3617
3618 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
3619 : T{std::move(tables), offset},
3620 mSelectedRows{getSpan(selection)}
3621 {
3622 if (this->tableSize() != 0) {
3623 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3624 }
3625 resetRanges();
3626 mFilteredBegin.bindInternalIndices(this);
3627 }
3628
3629 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
3630 : T{std::move(tables), offset},
3631 mSelectedRowsCache{std::move(selection)},
3632 mCached{true}
3633 {
3634 mSelectedRows = std::span{mSelectedRowsCache};
3635 if (this->tableSize() != 0) {
3636 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3637 }
3638 resetRanges();
3639 mFilteredBegin.bindInternalIndices(this);
3640 }
3641
3642 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
3643 : T{std::move(tables), offset},
3644 mSelectedRows{selection}
3645 {
3646 if (this->tableSize() != 0) {
3647 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3648 }
3649 resetRanges();
3650 mFilteredBegin.bindInternalIndices(this);
3651 }
3652
3654 {
3655 return iterator(mFilteredBegin);
3656 }
3657
3659 {
3660 return const_iterator(mFilteredBegin);
3661 }
3662
3664 {
3665 auto it = unfiltered_iterator{mFilteredBegin};
3666 it.setCursor(i);
3667 return it;
3668 }
3669
3670 [[nodiscard]] RowViewSentinel end() const
3671 {
3672 return RowViewSentinel{*mFilteredEnd};
3673 }
3674
3676 {
3677 return mFilteredBegin;
3678 }
3679
3680 auto const& cached_begin() const
3681 {
3682 return mFilteredBegin;
3683 }
3684
3685 iterator iteratorAt(uint64_t i) const
3686 {
3687 return mFilteredBegin + i;
3688 }
3689
3690 [[nodiscard]] int64_t size() const
3691 {
3692 return mSelectedRows.size();
3693 }
3694
3695 [[nodiscard]] int64_t tableSize() const
3696 {
3697 return table_t::asArrowTable()->num_rows();
3698 }
3699
3700 auto const& getSelectedRows() const
3701 {
3702 return mSelectedRows;
3703 }
3704
3705 auto rawSlice(uint64_t start, uint64_t end) const
3706 {
3707 SelectionVector newSelection;
3708 newSelection.resize(static_cast<int64_t>(end - start + 1));
3709 std::iota(newSelection.begin(), newSelection.end(), start);
3710 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3711 }
3712
3713 auto emptySlice() const
3714 {
3715 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
3716 }
3717
3718 static inline auto getSpan(gandiva::Selection const& sel)
3719 {
3720 if (sel == nullptr) {
3721 return std::span<int64_t const>{};
3722 }
3723 auto array = std::static_pointer_cast<arrow::Int64Array>(sel->ToArray());
3724 auto start = array->raw_values();
3725 auto stop = start + array->length();
3726 return std::span{start, stop};
3727 }
3728
3731 void bindExternalIndicesRaw(std::vector<o2::soa::Binding>&& ptrs)
3732 {
3733 mFilteredBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
3734 }
3735
3736 template <typename I>
3738 {
3739 mFilteredBegin.bindInternalIndices(ptr);
3740 }
3741
3742 template <typename T1, typename... Cs>
3744 {
3745 dest.bindExternalIndicesRaw(mFilteredBegin.getIndexBindings());
3746 }
3747
3748 template <typename T1>
3749 void copyIndexBindings(T1& dest) const
3750 {
3751 doCopyIndexBindings(external_index_columns_t{}, dest);
3752 }
3753
3754 template <typename T1>
3755 auto rawSliceBy(o2::framework::Preslice<T1> const& container, int value) const
3756 {
3757 return (table_t)this->sliceBy(container, value);
3758 }
3759
3761 {
3762 return doFilteredSliceByCached(this, node, value, cache);
3763 }
3764
3769
3770 template <typename T1, bool OPT>
3772 {
3773 return doFilteredSliceBy(this, container, value);
3774 }
3775
3776 template <typename T1, bool OPT>
3778 {
3779 return doSliceBy(this, container, value);
3780 }
3781
3783 {
3784 auto t = o2::soa::select(*this, f);
3785 copyIndexBindings(t);
3786 return t;
3787 }
3788
3789 int isInSelectedRows(int i) const
3790 {
3791 auto locate = std::find(mSelectedRows.begin(), mSelectedRows.end(), i);
3792 if (locate == mSelectedRows.end()) {
3793 return -1;
3794 }
3795 return static_cast<int>(std::distance(mSelectedRows.begin(), locate));
3796 }
3797
3798 void sumWithSelection(SelectionVector const& selection)
3799 {
3800 mCached = true;
3801 SelectionVector rowsUnion;
3802 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3803 mSelectedRowsCache.clear();
3804 mSelectedRowsCache = rowsUnion;
3805 resetRanges();
3806 }
3807
3809 {
3810 mCached = true;
3811 SelectionVector intersection;
3812 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3813 mSelectedRowsCache.clear();
3814 mSelectedRowsCache = intersection;
3815 resetRanges();
3816 }
3817
3818 void sumWithSelection(std::span<int64_t const> const& selection)
3819 {
3820 mCached = true;
3821 SelectionVector rowsUnion;
3822 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3823 mSelectedRowsCache.clear();
3824 mSelectedRowsCache = rowsUnion;
3825 resetRanges();
3826 }
3827
3828 void intersectWithSelection(std::span<int64_t const> const& selection)
3829 {
3830 mCached = true;
3831 SelectionVector intersection;
3832 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3833 mSelectedRowsCache.clear();
3834 mSelectedRowsCache = intersection;
3835 resetRanges();
3836 }
3837
3838 bool isCached() const
3839 {
3840 return mCached;
3841 }
3842
3843 private:
3844 void resetRanges()
3845 {
3846 if (mCached) {
3847 mSelectedRows = std::span{mSelectedRowsCache};
3848 }
3849 mFilteredEnd.reset(new RowViewSentinel{static_cast<int64_t>(mSelectedRows.size())});
3850 if (tableSize() == 0) {
3851 mFilteredBegin = *mFilteredEnd;
3852 } else {
3853 mFilteredBegin.resetSelection(mSelectedRows);
3854 }
3855 }
3856
3857 std::span<int64_t const> mSelectedRows;
3858 SelectionVector mSelectedRowsCache;
3859 bool mCached = false;
3860 iterator mFilteredBegin;
3861 std::shared_ptr<RowViewSentinel> mFilteredEnd;
3862};
3863
3864template <typename T>
3865class Filtered : public FilteredBase<T>
3866{
3867 public:
3868 using base_t = T;
3870 using table_t = typename T::table_t;
3871 using columns_t = typename T::columns_t;
3872
3873 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3874 using unfiltered_iterator = T::template iterator_template_o<DefaultIndexPolicy, self_t>;
3876
3878 {
3879 return iterator(this->cached_begin());
3880 }
3881
3883 {
3884 return const_iterator(this->cached_begin());
3885 }
3886
3887 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
3888 : FilteredBase<T>(std::move(tables), selection, offset) {}
3889
3890 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
3891 : FilteredBase<T>(std::move(tables), std::forward<SelectionVector>(selection), offset) {}
3892
3893 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
3894 : FilteredBase<T>(std::move(tables), selection, offset) {}
3895
3897 {
3898 Filtered<T> copy(*this);
3899 copy.sumWithSelection(selection);
3900 return copy;
3901 }
3902
3903 Filtered<T> operator+(std::span<int64_t const> const& selection)
3904 {
3905 Filtered<T> copy(*this);
3906 copy.sumWithSelection(selection);
3907 return copy;
3908 }
3909
3911 {
3912 return operator+(other.getSelectedRows());
3913 }
3914
3916 {
3917 this->sumWithSelection(selection);
3918 return *this;
3919 }
3920
3921 Filtered<T> operator+=(std::span<int64_t const> const& selection)
3922 {
3923 this->sumWithSelection(selection);
3924 return *this;
3925 }
3926
3928 {
3929 return operator+=(other.getSelectedRows());
3930 }
3931
3933 {
3934 Filtered<T> copy(*this);
3935 copy.intersectWithSelection(selection);
3936 return copy;
3937 }
3938
3939 Filtered<T> operator*(std::span<int64_t const> const& selection)
3940 {
3941 Filtered<T> copy(*this);
3942 copy.intersectWithSelection(selection);
3943 return copy;
3944 }
3945
3947 {
3948 return operator*(other.getSelectedRows());
3949 }
3950
3952 {
3953 this->intersectWithSelection(selection);
3954 return *this;
3955 }
3956
3957 Filtered<T> operator*=(std::span<int64_t const> const& selection)
3958 {
3959 this->intersectWithSelection(selection);
3960 return *this;
3961 }
3962
3964 {
3965 return operator*=(other.getSelectedRows());
3966 }
3967
3969 {
3970 auto it = unfiltered_iterator{this->cached_begin()};
3971 it.setCursor(i);
3972 return it;
3973 }
3974
3975 using FilteredBase<T>::getSelectedRows;
3976
3977 auto rawSlice(uint64_t start, uint64_t end) const
3978 {
3979 SelectionVector newSelection;
3980 newSelection.resize(static_cast<int64_t>(end - start + 1));
3981 std::iota(newSelection.begin(), newSelection.end(), start);
3982 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3983 }
3984
3985 auto emptySlice() const
3986 {
3987 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
3988 }
3989
3990 template <typename T1>
3991 auto rawSliceBy(o2::framework::Preslice<T1> const& container, int value) const
3992 {
3993 return (table_t)this->sliceBy(container, value);
3994 }
3995
3997 {
3998 return doFilteredSliceByCached(this, node, value, cache);
3999 }
4000
4005
4006 template <typename T1, bool OPT>
4008 {
4009 return doFilteredSliceBy(this, container, value);
4010 }
4011
4012 template <typename T1, bool OPT>
4014 {
4015 return doSliceBy(this, container, value);
4016 }
4017
4019 {
4020 auto t = o2::soa::select(*this, f);
4021 copyIndexBindings(t);
4022 return t;
4023 }
4024};
4025
4026template <typename T>
4027class Filtered<Filtered<T>> : public FilteredBase<typename T::table_t>
4028{
4029 public:
4031 using base_t = T;
4033 using columns_t = typename T::columns_t;
4034
4035 using iterator = typename T::template iterator_template_o<FilteredIndexPolicy, self_t>;
4036 using unfiltered_iterator = typename T::template iterator_template_o<DefaultIndexPolicy, self_t>;
4038
4040 {
4041 return iterator(this->cached_begin());
4042 }
4043
4045 {
4046 return const_iterator(this->cached_begin());
4047 }
4048
4049 Filtered(std::vector<Filtered<T>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
4050 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), selection, offset)
4051 {
4052 for (auto& table : tables) {
4053 *this *= table;
4054 }
4055 }
4056
4057 Filtered(std::vector<Filtered<T>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
4058 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), std::forward<SelectionVector>(selection), offset)
4059 {
4060 for (auto& table : tables) {
4061 *this *= table;
4062 }
4063 }
4064
4065 Filtered(std::vector<Filtered<T>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
4066 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), selection, offset)
4067 {
4068 for (auto& table : tables) {
4069 *this *= table;
4070 }
4071 }
4072
4074 {
4075 Filtered<Filtered<T>> copy(*this);
4076 copy.sumWithSelection(selection);
4077 return copy;
4078 }
4079
4080 Filtered<Filtered<T>> operator+(std::span<int64_t const> const& selection)
4081 {
4082 Filtered<Filtered<T>> copy(*this);
4083 copy.sumWithSelection(selection);
4084 return copy;
4085 }
4086
4088 {
4089 return operator+(other.getSelectedRows());
4090 }
4091
4093 {
4094 this->sumWithSelection(selection);
4095 return *this;
4096 }
4097
4098 Filtered<Filtered<T>> operator+=(std::span<int64_t const> const& selection)
4099 {
4100 this->sumWithSelection(selection);
4101 return *this;
4102 }
4103
4105 {
4106 return operator+=(other.getSelectedRows());
4107 }
4108
4110 {
4111 Filtered<Filtered<T>> copy(*this);
4112 copy.intersectionWithSelection(selection);
4113 return copy;
4114 }
4115
4116 Filtered<Filtered<T>> operator*(std::span<int64_t const> const& selection)
4117 {
4118 Filtered<Filtered<T>> copy(*this);
4119 copy.intersectionWithSelection(selection);
4120 return copy;
4121 }
4122
4124 {
4125 return operator*(other.getSelectedRows());
4126 }
4127
4129 {
4130 this->intersectWithSelection(selection);
4131 return *this;
4132 }
4133
4134 Filtered<Filtered<T>> operator*=(std::span<int64_t const> const& selection)
4135 {
4136 this->intersectWithSelection(selection);
4137 return *this;
4138 }
4139
4141 {
4142 return operator*=(other.getSelectedRows());
4143 }
4144
4146 {
4147 auto it = unfiltered_iterator{this->cached_begin()};
4148 it.setCursor(i);
4149 return it;
4150 }
4151
4152 auto rawSlice(uint64_t start, uint64_t end) const
4153 {
4154 SelectionVector newSelection;
4155 newSelection.resize(static_cast<int64_t>(end - start + 1));
4156 std::iota(newSelection.begin(), newSelection.end(), start);
4157 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
4158 }
4159
4160 auto emptySlice() const
4161 {
4162 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
4163 }
4164
4166 {
4167 return doFilteredSliceByCached(this, node, value, cache);
4168 }
4169
4174
4175 template <typename T1, bool OPT>
4177 {
4178 return doFilteredSliceBy(this, container, value);
4179 }
4180
4181 template <typename T1, bool OPT>
4183 {
4184 return doSliceBy(this, container, value);
4185 }
4186
4187 private:
4188 std::vector<std::shared_ptr<arrow::Table>> extractTablesFromFiltered(std::vector<Filtered<T>>& tables)
4189 {
4190 std::vector<std::shared_ptr<arrow::Table>> outTables;
4191 for (auto& table : tables) {
4192 outTables.push_back(table.asArrowTable());
4193 }
4194 return outTables;
4195 }
4196};
4197
4203template <typename L, typename D, typename O, typename Key, typename H, typename... Ts>
4204struct IndexTable : Table<L, D, O> {
4205 using self_t = IndexTable<L, D, O, Key, H, Ts...>;
4210 using first_t = typename H::binding_t;
4211 using rest_t = framework::pack<typename Ts::binding_t...>;
4212
4213 static constexpr const uint32_t binding_origin = Key::binding_origin;
4214 static constexpr const header::DataOrigin binding_origin_ = Key::binding_origin_;
4215
4216 template <typename... TA>
4217 void bindExternalIndices(TA*... current)
4218 {
4219 ([this](TA* cur) {
4220 if constexpr (binding_origin == TA::binding_origin) {
4221 this->bindExternalIndex(cur);
4222 }
4223 }(current),
4224 ...);
4225 }
4226
4227 IndexTable(std::shared_ptr<arrow::Table> table, uint64_t offset = 0)
4228 : base_t{table, offset}
4229 {
4230 }
4231
4232 IndexTable(std::vector<std::shared_ptr<arrow::Table>> tables, uint64_t offset = 0)
4233 : base_t{tables[0], offset}
4234 {
4235 }
4236
4237 IndexTable(IndexTable const&) = default;
4239 IndexTable& operator=(IndexTable const&) = default;
4241
4246};
4247
4248template <typename T, bool APPLY>
4249struct SmallGroupsBase : public Filtered<T> {
4250 static constexpr bool applyFilters = APPLY;
4251 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
4252 : Filtered<T>(std::move(tables), selection, offset) {}
4253
4254 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
4255 : Filtered<T>(std::move(tables), std::forward<SelectionVector>(selection), offset) {}
4256
4257 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
4258 : Filtered<T>(std::move(tables), selection, offset) {}
4259};
4260
4261template <typename T>
4263
4264template <typename T>
4266
4267template <typename T>
4268concept is_smallgroups = requires {
4269 []<typename B, bool A>(SmallGroupsBase<B, A>*) {}(std::declval<std::decay_t<T>*>());
4270};
4271} // namespace o2::soa
4272
4273#endif // O2_FRAMEWORK_ASOA_H_
header::DataDescription description
std::vector< std::string > labels
std::string binding
#define O2HASH(_Str_)
Pre-declare Hash specialization for a generic string.
Definition ASoA.h:294
#define O2ORIGIN(_Str_)
Pre-declare Hash specialization for an origin string.
Definition ASoA.h:302
consteval auto getIndexTargets()
SLICE.
Definition ASoA.h:2634
o2::monitoring::tags::Key Key
#define O2_BUILTIN_UNREACHABLE
#define O2_BUILTIN_LIKELY(x)
#define O2_BUILTIN_UNLIKELY(x)
Hit operator+(const Hit &lhs, const Hit &rhs)
Definition Hit.cxx:46
uint32_t hash
std::unique_ptr< expressions::Node > node
int32_t i
std::string columnLabel
uint16_t pos
Definition RawData.h:3
uint32_t res
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
uint32_t version
Definition RawData.h:8
TBranch * ptr
void merge(Options const &options)
StringRef key
Definition A.h:16
Definition B.h:16
Class for time synchronization of RawReader instances.
int64_t const * mCurrentPos
Definition ASoA.h:635
ColumnIterator(arrow::ChunkedArray const *column)
Definition ASoA.h:528
ColumnIterator(ColumnIterator< T, ChunkingPolicy > const &)=default
void moveToEnd()
Move the iterator to the end of the column.
Definition ASoA.h:586
ColumnIterator< T > & moveToPos()
Definition ASoA.h:628
auto operator*() const
Definition ASoA.h:602
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > const &)=default
unwrap_t< T > const * mCurrent
Definition ASoA.h:634
unwrap_t< T > const * mLast
Definition ASoA.h:636
ColumnIterator(ColumnIterator< T, ChunkingPolicy > &&)=default
void prevChunk() const
Definition ASoA.h:561
arrow::ChunkedArray const * mColumn
Definition ASoA.h:637
auto operator*() const
Definition ASoA.h:595
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > &&)=default
void moveToChunk(int chunk)
Definition ASoA.h:572
void nextChunk() const
Move the iterator to the next chunk.
Definition ASoA.h:550
bool isCached() const
Definition ASoA.h:3838
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3765
int64_t tableSize() const
Definition ASoA.h:3695
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:3618
auto & cached_begin()
Definition ASoA.h:3675
typename T::external_index_columns_t external_index_columns_t
Definition ASoA.h:3612
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:3782
static auto getSpan(gandiva::Selection const &sel)
Definition ASoA.h:3718
int64_t size() const
Definition ASoA.h:3690
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:3614
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
Definition ASoA.h:3755
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:3615
void copyIndexBindings(T1 &dest) const
Definition ASoA.h:3749
auto const & getSelectedRows() const
Definition ASoA.h:3700
void sumWithSelection(std::span< int64_t const > const &selection)
Definition ASoA.h:3818
void intersectWithSelection(std::span< int64_t const > const &selection)
Definition ASoA.h:3828
typename T::columns_t columns_t
Definition ASoA.h:3610
auto emptySlice() const
Definition ASoA.h:3713
void bindExternalIndices(TA *... current)
Definition ASoA.h:3600
void sumWithSelection(SelectionVector const &selection)
Definition ASoA.h:3798
void bindInternalIndicesTo(I const *ptr)
Definition ASoA.h:3737
void intersectWithSelection(SelectionVector const &selection)
Definition ASoA.h:3808
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:3777
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:3642
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3705
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:3771
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:3685
iterator const_iterator
Definition ASoA.h:3616
typename T::table_t table_t
Definition ASoA.h:3595
typename T::persistent_columns_t persistent_columns_t
Definition ASoA.h:3611
RowViewSentinel end() const
Definition ASoA.h:3670
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:3629
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:3731
const_iterator begin() const
Definition ASoA.h:3658
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3663
int isInSelectedRows(int i) const
Definition ASoA.h:3789
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3760
void doCopyIndexBindings(framework::pack< Cs... >, T1 &dest) const
Definition ASoA.h:3743
iterator begin()
Definition ASoA.h:3653
auto const & cached_begin() const
Definition ASoA.h:3680
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:4176
Filtered< Filtered< T > > operator*(std::span< int64_t const > const &selection)
Definition ASoA.h:4116
typename FilteredBase< typename T::table_t >::table_t table_t
Definition ASoA.h:4032
typename T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:4036
Filtered< Filtered< T > > operator+(SelectionVector const &selection)
Definition ASoA.h:4073
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:4182
Filtered< Filtered< T > > operator+=(std::span< int64_t const > const &selection)
Definition ASoA.h:4098
typename T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:4035
typename T::columns_t columns_t
Definition ASoA.h:4033
const_iterator begin() const
Definition ASoA.h:4044
Filtered(std::vector< Filtered< T > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:4065
Filtered< Filtered< T > > operator+(std::span< int64_t const > const &selection)
Definition ASoA.h:4080
Filtered(std::vector< Filtered< T > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:4057
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:4145
Filtered< Filtered< T > > operator*=(std::span< int64_t const > const &selection)
Definition ASoA.h:4134
Filtered< Filtered< T > > operator+=(Filtered< T > const &other)
Definition ASoA.h:4104
Filtered< Filtered< T > > operator+=(SelectionVector const &selection)
Definition ASoA.h:4092
Filtered< Filtered< T > > operator*=(SelectionVector const &selection)
Definition ASoA.h:4128
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:4152
Filtered< Filtered< T > > operator+(Filtered< T > const &other)
Definition ASoA.h:4087
Filtered(std::vector< Filtered< T > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:4049
Filtered< Filtered< T > > operator*=(Filtered< T > const &other)
Definition ASoA.h:4140
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4165
Filtered< Filtered< T > > operator*(Filtered< T > const &other)
Definition ASoA.h:4123
Filtered< Filtered< T > > operator*(SelectionVector const &selection)
Definition ASoA.h:4109
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4170
Filtered< T > operator*(std::span< int64_t const > const &selection)
Definition ASoA.h:3939
Filtered< T > operator+=(Filtered< T > const &other)
Definition ASoA.h:3927
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:4013
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:3890
iterator const_iterator
Definition ASoA.h:3875
Filtered< T > operator+(std::span< int64_t const > const &selection)
Definition ASoA.h:3903
iterator begin()
Definition ASoA.h:3877
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4001
Filtered< T > operator+(Filtered< T > const &other)
Definition ASoA.h:3910
Filtered< T > operator*=(SelectionVector const &selection)
Definition ASoA.h:3951
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:3893
auto emptySlice() const
Definition ASoA.h:3985
const_iterator begin() const
Definition ASoA.h:3882
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:3873
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3996
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:4018
Filtered< T > operator+(SelectionVector const &selection)
Definition ASoA.h:3896
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:3874
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3968
Filtered< T > operator*(SelectionVector const &selection)
Definition ASoA.h:3932
Filtered< T > operator*=(Filtered< T > const &other)
Definition ASoA.h:3963
Filtered< T > operator*(Filtered< T > const &other)
Definition ASoA.h:3946
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
Definition ASoA.h:3991
Filtered< T > operator+=(SelectionVector const &selection)
Definition ASoA.h:3915
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3977
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:3887
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:4007
Filtered< T > operator*=(std::span< int64_t const > const &selection)
Definition ASoA.h:3957
Filtered< T > operator+=(std::span< int64_t const > const &selection)
Definition ASoA.h:3921
typename T::table_t table_t
Definition ASoA.h:3870
typename T::columns_t columns_t
Definition ASoA.h:3871
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_self_index_t, C... > {}(columns_t{})) internal_index_columns_t
Definition ASoA.h:1880
void bindInternalIndicesExplicit(o2::soa::Binding binding)
Definition ASoA.h:2218
auto & cached_begin()
Definition ASoA.h:2121
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:2150
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_persistent_column_t, C... > {}(columns_t{})) persistent_columns_t
Definition ASoA.h:1876
static constexpr const auto ref
Definition ASoA.h:1833
auto offset() const
Return offset.
Definition ASoA.h:2178
static consteval bool hasOriginal()
Definition ASoA.h:1869
unfiltered_iterator begin()
Definition ASoA.h:2131
int64_t tableSize() const
Definition ASoA.h:2188
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:2269
void bindExternalIndices(TA *... current)
Definition ASoA.h:2196
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:2246
unfiltered_iterator unfiltered_const_iterator
Definition ASoA.h:2062
static consteval auto full_iter()
Definition ASoA.h:2041
auto const & cached_begin() const
Definition ASoA.h:2126
auto emptySlice() const
Definition ASoA.h:2274
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:2258
static constexpr header::DataOrigin binding_origin_
Definition ASoA.h:1842
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:2229
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
Definition ASoA.h:2264
static constexpr auto hashes()
Definition ASoA.h:2064
iterator unfiltered_iterator
Definition ASoA.h:2060
void bindExternalIndex(TA *current)
Definition ASoA.h:2207
std::shared_ptr< arrow::Table > asArrowTable() const
Return a type erased arrow table backing store for / the type safe table.
Definition ASoA.h:2173
filtered_iterator filtered_begin(std::span< int64_t const > selection)
Definition ASoA.h:2141
void doCopyIndexBindings(framework::pack< Cs... >, T &dest) const
Definition ASoA.h:2235
int64_t size() const
Size of the table, in rows.
Definition ASoA.h:2183
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:2095
decltype(getColumns< ref, Ts... >()) columns_t
Definition ASoA.h:1874
arrow::ChunkedArray * getIndexToKey()
Definition ASoA.h:2102
RowViewSentinel end()
Definition ASoA.h:2136
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::type... > {}(persistent_columns_t{})) column_types
Definition ASoA.h:1877
static constexpr const uint32_t binding_origin
Definition ASoA.h:1841
static consteval auto isIndexTargetOf()
Definition ASoA.h:1846
iterator_template_o< FilteredIndexPolicy, table_t > filtered_iterator
Definition ASoA.h:2058
unfiltered_const_iterator begin() const
Definition ASoA.h:2162
void copyIndexBindings(T &dest) const
Definition ASoA.h:2241
static constexpr const auto originalLabels
Definition ASoA.h:1838
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:2089
Table< L, D, O, Ts... > self_t
Definition ASoA.h:1834
static consteval auto isIndexTargetOf()
Definition ASoA.h:1853
decltype(full_iter< IP, Parent >()) iterator_template_o
Definition ASoA.h:2055
void doBindInternalIndicesExplicit(framework::pack< Cs... >, o2::soa::Binding binding)
Definition ASoA.h:2224
static constexpr const auto originals
Definition ASoA.h:1837
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_external_index_t, C... > {}(columns_t{})) external_index_columns_t
Definition ASoA.h:1879
Table(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
Definition ASoA.h:2069
RowViewSentinel end() const
Definition ASoA.h:2167
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:2253
void bindInternalIndicesTo(I const *ptr)
Definition ASoA.h:2213
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:2155
iterator_template_o< DefaultIndexPolicy, table_t > iterator
Definition ASoA.h:2057
hash identification concepts
Definition ASoA.h:387
Helper to check if a type T is an iterator.
Definition ASoA.h:1313
column identification concepts
Definition ASoA.h:195
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum func
Definition glcorearb.h:778
GLint GLsizei count
Definition glcorearb.h:399
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLsizei const GLuint const GLintptr * offsets
Definition glcorearb.h:2595
GLuint GLuint end
Definition glcorearb.h:469
GLenum array
Definition glcorearb.h:4274
GLuint index
Definition glcorearb.h:781
GLuint const GLchar * name
Definition glcorearb.h:781
GLdouble f
Definition glcorearb.h:310
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLenum target
Definition glcorearb.h:1641
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLboolean * data
Definition glcorearb.h:298
GLintptr offset
Definition glcorearb.h:660
GLuint GLsizei GLsizei * length
Definition glcorearb.h:790
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLsizei GLenum const void * indices
Definition glcorearb.h:400
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean r
Definition glcorearb.h:1233
GLuint start
Definition glcorearb.h:469
GLenum GLenum GLsizei len
Definition glcorearb.h:4232
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLint ref
Definition glcorearb.h:291
std::shared_ptr< gandiva::SelectionVector > Selection
Definition Expressions.h:46
consteval const char * origin_str()
Definition ASoA.h:362
consteval const char * signature()
Definition ASoA.h:374
consteval auto replaceOrigin()
Replace origins in the TableRef array.
Definition ASoA.h:401
constexpr framework::ConcreteDataMatcher matcher()
Definition ASoA.h:380
consteval auto filterForKey()
Filter TableRef array for compatibility with Key table.
Definition ASoA.h:282
consteval const char * label()
Definition ASoA.h:356
consteval header::DataOrigin origin()
Definition ASoA.h:368
gandiva::Selection createSelection(std::shared_ptr< arrow::Table > const &table, Filter const &expression)
Function for creating gandiva selection from our internal filter tree.
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::decay_t< decltype(select_pack< Condition >(pack<>{}, Pack{}, CondPack{}))> selected_pack_multicondition
Definition Pack.h:181
std::decay_t< decltype(prune_voids_pack(pack<>{}, with_condition_pack< Condition, Types... >{}))> selected_pack
Definition Pack.h:179
decltype(intersected_pack(Ps{}...)) full_intersected_pack_t
Definition Pack.h:283
typename pack_element< I, T >::type pack_element_t
Definition Pack.h:56
consteval size_t has_type_at_v(pack< Ts... >)
Definition Pack.h:228
constexpr std::size_t pack_size(pack< Ts... > const &)
template function to determine number of types in a pack
Definition Pack.h:28
decltype(concatenate_pack_unique(Ps{}...)) concatenated_pack_unique_t
Definition Pack.h:319
std::string strToUpper(std::string &&str)
Definition ASoA.cxx:285
typename pack_element< 0, T >::type pack_head_t
Definition Pack.h:59
std::string cutString(std::string &&str)
Definition ASoA.cxx:276
std::vector< std::vector< int64_t > > ListVector
Descriptor< gSizeDataDescriptionString > DataDescription
Definition DataHeader.h:551
R getColumnValue(const T &rowIterator)
Definition ASoA.h:2307
ColumnGetterFunction< R, typename T::iterator > getColumnGetterByLabel(const std::string_view &targetColumnLabel)
Definition ASoA.h:2374
void * extractCCDBPayload(char *payload, size_t size, TClass const *cl, const char *what)
Definition ASoA.cxx:206
consteval auto computeOriginals()
Definition ASoA.h:1815
auto createFieldsFromColumns(framework::pack< C... >)
Definition ASoA.h:58
SelectionVector selectionToVector(gandiva::Selection const &sel)
Definition ASoA.cxx:48
constexpr bool is_persistent_v
Definition ASoA.h:198
constexpr bool is_ng_index_equivalent_v
Definition ASoA.h:480
consteval auto remove_if(L l)
Definition ASoA.h:136
constexpr auto join(Ts const &... t)
Definition ASoA.h:3541
auto doSliceBy(T const *table, o2::framework::PresliceBase< C, Policy, OPT > const &container, int value)
Definition ASoA.h:1638
void notBoundTable(const char *tableName)
Definition ASoA.cxx:191
SelectionVector sliceSelection(std::span< int64_t const > const &mSelectedRows, int64_t nrows, uint64_t offset)
Definition ASoA.cxx:58
auto doFilteredSliceBy(T const *table, o2::framework::PresliceBase< C, framework::PreslicePolicySorted, OPT > const &container, int value)
Definition ASoA.h:1714
constexpr auto concat(Ts const &... t)
Definition ASoA.h:3585
consteval auto intersectOriginals()
Definition ASoA.h:171
consteval auto getColumns()
Definition ASoA.h:1787
std::vector< int64_t > SelectionVector
Definition ASoA.h:443
std::conditional_t< is_binding_compatible_v< T, typename B::binding_t >(), std::true_type, std::false_type > is_binding_compatible
Definition ASoA.h:1373
consteval auto mergeOriginals()
Definition ASoA.h:154
constexpr bool is_soa_filtered_v
Definition ASoA.h:1619
typename std::conditional_t< is_index_column< C >, std::true_type, std::false_type > is_external_index_t
Definition ASoA.h:213
void missingFilterDeclaration(int hash, int ai)
Definition ASoA.cxx:33
auto doSliceByCachedUnsorted(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
Definition ASoA.h:1752
auto doSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
Definition ASoA.h:1729
void accessingInvalidIndexFor(const char *getter)
Definition ASoA.cxx:25
auto select(T const &t, framework::expressions::Filter const &f)
Definition ASoA.h:1773
consteval auto base_iter(framework::pack< C... > &&) -> TableIterator< D, O, IP, C... >
Definition ASoA.h:1781
constexpr bool is_index_equivalent_v
Definition ASoA.h:477
constexpr bool is_soa_join_v
Definition ASoA.h:3550
void dereferenceWithWrongType(const char *getter, const char *target)
Definition ASoA.cxx:29
std::conditional_t< is_indexing_column< T >, std::true_type, std::false_type > is_indexing_t
Definition ASoA.h:866
consteval bool is_binding_compatible_v()
Definition ASoA.h:1367
auto prepareFilteredSlice(T const *table, std::shared_ptr< arrow::Table > slice, uint64_t offset)
Definition ASoA.h:1695
void emptyColumnLabel()
Definition ASoA.cxx:43
typename unwrap< T >::type unwrap_t
Definition ASoA.h:512
void getterNotFound(const char *targetColumnLabel)
Definition ASoA.cxx:38
auto doFilteredSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
Definition ASoA.h:1742
void missingOptionalPreslice(const char *label, const char *key)
Definition ASoA.cxx:201
auto doSliceByHelper(T const *table, std::span< const int64_t > const &selection)
Definition ASoA.h:1656
std::function< framework::ConcreteDataMatcher(framework::ConcreteDataMatcher &&)> originReplacement(header::DataOrigin newOrigin)
Definition ASoA.cxx:262
consteval bool is_compatible()
Definition ASoA.h:1354
arrow::ChunkedArray * getIndexFromLabel(arrow::Table *table, std::string_view label)
Definition ASoA.cxx:170
consteval auto merge()
Helpers to manipulate TableRef arrays.
Definition ASoA.h:113
consteval auto merge_if(L l)
Definition ASoA.h:124
std::conditional_t< is_persistent_column< C >, std::true_type, std::false_type > is_persistent_column_t
Definition ASoA.h:201
typename arrow_array_for< T >::type arrow_array_for_t
Definition ArrowTypes.h:118
void notFoundColumn(const char *label, const char *key)
Definition ASoA.cxx:196
std::conditional_t< is_dynamic_column< T >, std::true_type, std::false_type > is_dynamic_t
Definition ASoA.h:860
typename std::conditional_t< is_self_index_column< C >, std::true_type, std::false_type > is_self_index_t
Definition ASoA.h:216
@ C
Definition Defs.h:36
FIXME: do not use data model tables.
static constexpr uint32_t hash
Definition ASoA.h:276
static constexpr char const *const str
Definition ASoA.h:277
Base type for table metadata.
Definition ASoA.h:237
static consteval int getIndexPosToKey()
Definition ASoA.h:256
framework::selected_pack< soa::is_self_index_t, Cs... > internal_index_columns_t
Definition ASoA.h:241
framework::selected_pack< soa::is_persistent_column_t, Cs... > persistent_columns_t
Definition ASoA.h:239
static std::shared_ptr< arrow::Schema > getSchema()
Definition ASoA.h:261
framework::selected_pack< soa::is_external_index_t, Cs... > external_index_columns_t
Definition ASoA.h:240
static consteval std::array< bool, sizeof...(PCs)> getMap(framework::pack< PCs... >)
Definition ASoA.h:244
SliceInfoUnsortedPtr getCacheUnsortedFor(Entry const &bindingKey) const
SliceInfoPtr getCacheFor(Entry const &bindingKey) const
std::shared_ptr< arrow::Table > getSliceFor(int value, std::shared_ptr< arrow::Table > const &input, uint64_t &offset) const
Definition ASoA.h:1544
static constexpr bool optional
Definition ASoA.h:1534
PresliceBase(expressions::BindingNode index_)
Definition ASoA.h:1539
std::span< const int64_t > getSliceFor(int value) const
Definition ASoA.h:1554
const std::string binding
Definition ASoA.h:1537
tracks origin in bindingKey matcher to handle the correct arguments
Definition ASoA.h:1507
const std::string binding
Definition ASoA.h:1508
Entry const & getBindingKey() const
Definition ASoA.cxx:296
SliceInfoUnsortedPtr sliceInfo
Definition ASoA.h:1525
std::span< const int64_t > getSliceFor(int value) const
Definition ASoA.cxx:319
void updateSliceInfo(SliceInfoUnsortedPtr &&si)
Definition ASoA.cxx:306
void updateSliceInfo(SliceInfoPtr &&si)
Definition ASoA.cxx:301
std::shared_ptr< arrow::Table > getSliceFor(int value, std::shared_ptr< arrow::Table > const &input, uint64_t &offset) const
Definition ASoA.cxx:311
ArrowTableSlicingCache * ptr
Definition SliceCache.h:22
std::pair< int64_t, int64_t > getSliceFor(int value) const
An expression tree node corresponding to a column binding.
A struct, containing the root of the expression tree.
From https://en.cppreference.com/w/cpp/utility/variant/visit.
static std::shared_ptr< arrow::Table > joinTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
Definition ASoA.cxx:72
static std::shared_ptr< arrow::Table > concatTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
Definition ASoA.cxx:132
Type-checking index column binding.
Definition ASoA.h:420
uint32_t hash
Definition ASoA.h:422
void const * ptr
Definition ASoA.h:421
void bind(T const *table)
Definition ASoA.h:426
T const * get() const
Definition ASoA.h:434
static constexpr bool chunked
Definition ASoA.h:486
arrow::ChunkedArray * second
Definition ASoA.h:1073
Column(ColumnIterator< T > const &it)
Definition ASoA.h:696
Column()=default
static constexpr const char *const & columnLabel()
Definition ASoA.h:709
ColumnIterator< T > const & getIterator() const
Definition ASoA.h:710
Column & operator=(Column const &)=default
INHERIT inherited_t
Definition ASoA.h:695
Column(Column &&)=default
static auto asArrowField()
Definition ASoA.h:715
Column & operator=(Column &&)=default
Column(Column const &)=default
ColumnIterator< T > mColumnIterator
Definition ASoA.h:722
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
Definition ASoA.h:3576
Concat(Ts const &... t, uint64_t offset=0)
Definition ASoA.h:3561
typename table_t::persistent_columns_t persistent_columns_t
Definition ASoA.h:3574
typename table_t::columns_t columns_t
Definition ASoA.h:3573
iterator const_iterator
Definition ASoA.h:3577
const_iterator unfiltered_const_iterator
Definition ASoA.h:3579
iterator unfiltered_iterator
Definition ASoA.h:3578
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Definition ASoA.h:3580
Concat(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:3556
filtered_iterator filtered_const_iterator
Definition ASoA.h:3581
DefaultIndexPolicy(int64_t nRows, uint64_t offset)
Definition ASoA.h:995
friend bool operator==(DefaultIndexPolicy const &lh, DefaultIndexPolicy const &rh)
Definition ASoA.h:1041
bool operator==(RowViewSentinel const &sentinel) const
Definition ASoA.h:1046
DefaultIndexPolicy(FilteredIndexPolicy const &other)
Definition ASoA.h:1001
std::tuple< uint64_t const * > getOffsets() const
Definition ASoA.h:1022
DefaultIndexPolicy & operator=(DefaultIndexPolicy &&)=default
void setCursor(int64_t i)
Definition ASoA.h:1027
void limitRange(int64_t start, int64_t end)
Definition ASoA.h:1007
DefaultIndexPolicy(DefaultIndexPolicy &&)=default
DefaultIndexPolicy(DefaultIndexPolicy const &)=default
DefaultIndexPolicy & operator=(DefaultIndexPolicy const &)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
Definition ASoA.h:1016
DefaultIndexPolicy()=default
Needed to be able to copy the policy.
void moveByIndex(int64_t i)
Definition ASoA.h:1031
static constexpr const char *const & columnLabel()
Definition ASoA.h:731
INHERIT inherited_t
Definition ASoA.h:729
FilteredIndexPolicy & operator=(FilteredIndexPolicy &&)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
Definition ASoA.h:908
FilteredIndexPolicy & operator=(FilteredIndexPolicy const &)=default
auto getSelectionRow() const
Definition ASoA.h:958
FilteredIndexPolicy(std::span< int64_t const > selection, int64_t rows, uint64_t offset=0)
Definition ASoA.h:885
friend bool operator==(FilteredIndexPolicy const &lh, FilteredIndexPolicy const &rh)
Definition ASoA.h:939
void resetSelection(std::span< int64_t const > selection)
Definition ASoA.h:894
void setCursor(int64_t i)
Definition ASoA.h:927
FilteredIndexPolicy(FilteredIndexPolicy const &)=default
auto raw_size() const
Definition ASoA.h:968
bool operator==(RowViewSentinel const &sentinel) const
Definition ASoA.h:944
std::tuple< uint64_t const * > getOffsets() const
Definition ASoA.h:914
void limitRange(int64_t start, int64_t end)
Definition ASoA.h:919
FilteredIndexPolicy(FilteredIndexPolicy &&)=default
void moveByIndex(int64_t i)
Definition ASoA.h:933
static constexpr bool chunked
Definition ASoA.h:492
static constexpr const char *const & columnLabel()
Definition ASoA.h:739
INHERIT inherited_t
Definition ASoA.h:736
static constexpr const uint32_t hash
Definition ASoA.h:737
uint64_t mOffset
Offset within a larger table.
Definition ASoA.h:872
int64_t mRowIndex
Position inside the current table.
Definition ASoA.h:870
IndexTable(std::vector< std::shared_ptr< arrow::Table > > tables, uint64_t offset=0)
Definition ASoA.h:4232
void bindExternalIndices(TA *... current)
Definition ASoA.h:4217
IndexTable(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
Definition ASoA.h:4227
typename base_t::template iterator_template_o< DefaultIndexPolicy, self_t > iterator
Definition ASoA.h:4242
filtered_iterator const_filtered_iterator
Definition ASoA.h:4245
IndexTable(IndexTable &&)=default
IndexTable & operator=(IndexTable const &)=default
iterator const_iterator
Definition ASoA.h:4243
IndexTable & operator=(IndexTable &&)=default
typename H::binding_t first_t
Definition ASoA.h:4210
typename base_t::template iterator_template_o< FilteredIndexPolicy, self_t > filtered_iterator
Definition ASoA.h:4244
IndexTable(IndexTable const &)=default
Index(Index const &)=default
void setIndices(std::tuple< int64_t const *, int64_t const * > indices)
Definition ASoA.h:826
Index & operator=(Index &&)=default
int64_t index() const
Definition ASoA.h:799
Index()=default
Index(arrow::ChunkedArray const *)
Definition ASoA.h:785
int64_t filteredIndex() const
Definition ASoA.h:804
constexpr int64_t rangeEnd()
Definition ASoA.h:794
constexpr int64_t rangeStart()
Definition ASoA.h:789
Index(Index &&)=default
Index & operator=(Index const &)=default
int64_t index() const
Definition ASoA.h:815
int64_t globalIndex() const
Definition ASoA.h:809
std::tuple< int64_t const *, int64_t const * > rowIndices
Definition ASoA.h:839
int64_t offsets() const
Definition ASoA.h:821
void setOffsets(std::tuple< uint64_t const * > offsets)
Definition ASoA.h:831
static constexpr const char * mLabel
Definition ASoA.h:836
std::tuple< uint64_t const * > rowOffsets
Definition ASoA.h:842
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
Definition ASoA.h:3504
static constexpr const auto originalLabels
Definition ASoA.h:3473
iterator const_iterator
Definition ASoA.h:3477
Join(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:3447
static constexpr const auto originals
Definition ASoA.h:3472
iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3509
static constexpr const uint32_t binding_origin
Definition ASoA.h:3456
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3493
const_iterator unfiltered_const_iterator
Definition ASoA.h:3479
typename table_t::columns_t columns_t
Definition ASoA.h:3474
auto emptySlice() const
Definition ASoA.h:3526
Table< o2::aod::Hash<"JOIN"_h >, o2::aod::Hash<"JOIN/0"_h >, o2::aod::Hash<"JOIN"_h >, Ts... > base
Definition ASoA.h:3438
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:3516
typename table_t::persistent_columns_t persistent_columns_t
Definition ASoA.h:3475
Join< Ts... > self_t
Definition ASoA.h:3470
const_iterator begin() const
Definition ASoA.h:3488
void bindExternalIndices(TA *... current)
Definition ASoA.h:3460
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
Definition ASoA.h:3476
static consteval bool contains()
Definition ASoA.h:3532
Join(std::shared_ptr< arrow::Table > &&table, uint64_t offset=0)
Definition ASoA.h:3440
iterator begin()
Definition ASoA.h:3483
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Definition ASoA.h:3480
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3498
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3521
static constexpr const header::DataOrigin binding_origin_
Definition ASoA.h:3457
iterator unfiltered_iterator
Definition ASoA.h:3478
filtered_iterator filtered_const_iterator
Definition ASoA.h:3481
static constexpr const uint32_t hash
Definition ASoA.h:745
static constexpr const char *const & columnLabel()
Definition ASoA.h:747
INHERIT inherited_t
Definition ASoA.h:744
constexpr auto mark()
Definition ASoA.h:764
Marker & operator=(Marker const &)=default
size_t type
Definition ASoA.h:752
static constexpr auto value
Definition ASoA.h:754
static constexpr const char * mLabel
Definition ASoA.h:769
Marker(arrow::ChunkedArray const *)
Definition ASoA.h:763
Marker()=default
Marker(Marker const &)=default
Marker & operator=(Marker &&)=default
Marker(Marker &&)=default
int64_t const index
Definition ASoA.h:876
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:4254
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:4257
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:4251
framework::selected_pack< soa::is_persistent_column_t, C... > persistent_columns_t
Definition ASoA.h:1090
void doSetCurrentIndexRaw(framework::pack< Cs... > p, std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:1228
void bindInternalIndices(I const *table)
Definition ASoA.h:1247
TableIterator(TableIterator< D, O, FilteredIndexPolicy, C... > const &other)
Definition ASoA.h:1139
TableIterator(self_t const &other)
Definition ASoA.h:1120
TableIterator operator-(int64_t dec) const
Definition ASoA.h:1183
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
Definition ASoA.h:1104
TableIterator & operator=(TableIterator other)
Definition ASoA.h:1129
TableIterator & operator++()
Definition ASoA.h:1149
void bindExternalIndex(TA *current)
Definition ASoA.h:1220
void doSetCurrentInternal(framework::pack< Cs... >, I const *ptr)
Definition ASoA.h:1234
auto getIndexBindingsImpl(framework::pack< Cs... >) const
Definition ASoA.h:1200
TableIterator operator--(int)
Definition ASoA.h:1168
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:1241
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
Definition ASoA.h:1095
decltype([]< typename... Cs >(framework::pack< Cs... >) -> framework::pack< typename Cs::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
Definition ASoA.h:1093
void bindExternalIndices(TA *... current)
Definition ASoA.h:1211
auto getCurrent() const
Definition ASoA.h:1194
TableIterator & operator--()
Definition ASoA.h:1162
framework::selected_pack< soa::is_external_index_t, C... > external_index_columns_t
Definition ASoA.h:1091
TableIterator const & operator*() const
Definition ASoA.h:1188
TableIterator operator++(int)
Definition ASoA.h:1155
framework::selected_pack< soa::is_self_index_t, C... > internal_index_columns_t
Definition ASoA.h:1092
auto getIndexBindings() const
Definition ASoA.h:1205
TableIterator operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
Definition ASoA.h:1176
Generic identifier for a table type.
Definition ASoA.h:67
constexpr TableRef & operator=(TableRef const &)=default
consteval TableRef()
Definition ASoA.h:68
uint32_t label_hash
Definition ASoA.h:82
constexpr bool descriptionCompatible(uint32_t _desc_hash) const noexcept
Definition ASoA.h:100
constexpr bool operator==(TableRef const &other) const noexcept
Definition ASoA.h:87
constexpr TableRef(TableRef &&)=default
uint32_t version
Definition ASoA.h:85
constexpr TableRef(TableRef const &)=default
consteval TableRef(uint32_t _label, uint32_t _desc, uint32_t _origin, uint32_t _version)
Definition ASoA.h:75
constexpr bool descriptionCompatible(TableRef const &other) const noexcept
Definition ASoA.h:95
uint32_t desc_hash
Definition ASoA.h:83
uint32_t origin_hash
Definition ASoA.h:84
constexpr TableRef & operator=(TableRef &&)=default
TableIteratorBase const & operator*() const
Definition ASoA.h:2031
TableIteratorBase(TableIteratorBase< IP, P, T... > const &other)
Definition ASoA.h:1939
typename Parent::columns_t columns_t
Definition ASoA.h:1886
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > const &other)
Definition ASoA.h:1925
typename Parent::external_index_columns_t external_index_columns_t
Definition ASoA.h:1887
TableIteratorBase operator-(int64_t dec) const
Definition ASoA.h:2026
void matchTo(TableIteratorBase< IP, P, T... > const &other)
Definition ASoA.h:1963
void matchTo(TableIteratorBase< IP, P, Os... > const &other)
Definition ASoA.h:1969
TableIteratorBase(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
Definition ASoA.h:1951
std::array< B, sizeof...(CCs)> getValues() const
Definition ASoA.h:2008
static constexpr auto originals
Definition ASoA.h:1890
TableIteratorBase(TableIteratorBase< IP, P, T... > &&other) noexcept
Definition ASoA.h:1945
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
Definition ASoA.h:1888
TableIteratorBase & operator=(TableIteratorBase< IP, P, Os... > other)
Definition ASoA.h:1902
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > &&other) noexcept
Definition ASoA.h:1932
TableIteratorBase & operator=(RowViewSentinel const &other)
Definition ASoA.h:1957
TableIteratorBase(arrow::ChunkedArray *columnData[framework::pack_size(columns_t{})], IP &&policy)
Definition ASoA.h:1896
TableIteratorBase & operator=(TableIteratorBase< IP, P, T... > other)
Definition ASoA.h:1910
TableIteratorBase operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
Definition ASoA.h:2019
TableIteratorBase & operator=(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
Definition ASoA.h:1917
unwrapper
Definition ASoA.h:497
VectorOfTObjectPtrs other
std::vector< ReadoutWindowData > rows
const std::string str