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 const& key)
1414{
1415 auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string& 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 const& 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 const& key)
1434{
1435 return {hasColumnForKey(typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{}, key), aod::matcher<ref>()};
1436}
1437
1438template <typename... C>
1439static constexpr auto haveKey(framework::pack<C...>, std::string const& key)
1440{
1441 return std::vector{hasKey<C>(key)...};
1442}
1443
1444void notFoundColumn(const char* label, const char* key);
1445void missingOptionalPreslice(const char* label, const char* key);
1446
1447template <with_originals T, bool OPT = false>
1448static constexpr std::string getLabelFromTypeForKey(std::string const& key)
1449{
1450 if constexpr (T::originals.size() == 1) {
1451 auto locate = hasKey<T::originals[0]>(key);
1452 if (locate.first) {
1453 return locate.second;
1454 }
1455 } else {
1456 auto locate = [&]<size_t... Is>(std::index_sequence<Is...>) {
1457 return std::vector{hasKey<T::originals[Is]>(key)...};
1458 }(std::make_index_sequence<T::originals.size()>{});
1459 auto it = std::find_if(locate.begin(), locate.end(), [](auto const& x) { return x.first; });
1460 if (it != locate.end()) {
1461 return it->second;
1462 }
1463 }
1464 if constexpr (!OPT) {
1465 notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
1466 } else {
1467 return "[MISSING]";
1468 }
1470}
1471
1472template <with_originals T, bool OPT = false>
1473static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey(std::string const& key)
1474{
1475 if constexpr (T::originals.size() == 1) {
1476 auto locate = hasKeyM<T::originals[0]>(key);
1477 if (locate.first) {
1478 return locate.second;
1479 }
1480 } else {
1481 auto locate = [&]<size_t... Is>(std::index_sequence<Is...>) {
1482 return std::vector{hasKeyM<T::originals[Is]>(key)...};
1483 }(std::make_index_sequence<T::originals.size()>{});
1484 auto it = std::find_if(locate.begin(), locate.end(), [](auto const& x) { return x.first; });
1485 if (it != locate.end()) {
1486 return it->second;
1487 }
1488 }
1489 if constexpr (!OPT) {
1490 notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
1491 } else {
1493 }
1495}
1496
1497template <typename B, typename... C>
1498consteval static bool hasIndexTo(framework::pack<C...>&&)
1499{
1500 return (o2::soa::is_binding_compatible_v<B, typename C::binding_t>() || ...);
1501}
1502
1503template <typename B, typename... C>
1504consteval static bool hasSortedIndexTo(framework::pack<C...>&&)
1505{
1506 return ((C::sorted && o2::soa::is_binding_compatible_v<B, typename C::binding_t>()) || ...);
1507}
1508
1509template <typename B, typename Z>
1510consteval static bool relatedByIndex()
1511{
1512 return hasIndexTo<B>(typename Z::table_t::external_index_columns_t{});
1513}
1514
1515template <typename B, typename Z>
1516consteval static bool relatedBySortedIndex()
1517{
1518 return hasSortedIndexTo<B>(typename Z::table_t::external_index_columns_t{});
1519}
1520} // namespace o2::soa
1521
1522namespace o2::framework
1523{
1524
1526 const std::string binding;
1528
1529 bool isMissing() const;
1530 Entry const& getBindingKey() const;
1531};
1532
1534 void updateSliceInfo(SliceInfoPtr&& si);
1535
1537 std::shared_ptr<arrow::Table> getSliceFor(int value, std::shared_ptr<arrow::Table> const& input, uint64_t& offset) const;
1538};
1539
1542
1544 std::span<const int64_t> getSliceFor(int value) const;
1545};
1546
1547template <typename T>
1548concept is_preslice_policy = std::derived_from<T, PreslicePolicyBase>;
1549
1550template <typename T, is_preslice_policy Policy, bool OPT = false>
1551struct PresliceBase : public Policy {
1552 constexpr static bool optional = OPT;
1553 using target_t = T;
1554 using policy_t = Policy;
1555 const std::string binding;
1556
1558 : 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})}, {}}
1559 {
1560 }
1561
1562 std::shared_ptr<arrow::Table> getSliceFor(int value, std::shared_ptr<arrow::Table> const& input, uint64_t& offset) const
1563 {
1564 if constexpr (OPT) {
1565 if (Policy::isMissing()) {
1566 return nullptr;
1567 }
1568 }
1569 return Policy::getSliceFor(value, input, offset);
1570 }
1571
1572 std::span<const int64_t> getSliceFor(int value) const
1573 {
1574 if constexpr (OPT) {
1575 if (Policy::isMissing()) {
1576 return {};
1577 }
1578 }
1579 return Policy::getSliceFor(value);
1580 }
1581};
1582
1583template <typename T>
1585template <typename T>
1587template <typename T>
1589template <typename T>
1591
1592template <typename T>
1593concept is_preslice = std::derived_from<T, PreslicePolicyBase>&&
1594 requires(T)
1595{
1596 T::optional;
1597};
1598
1612};
1613
1614template <typename T>
1615concept is_preslice_group = std::derived_from<T, PresliceGroup>;
1616
1617} // namespace o2::framework
1618
1619namespace o2::soa
1620{
1621template <soa::is_table T>
1622class FilteredBase;
1623template <typename T>
1624class Filtered;
1625
1626template <typename T>
1627concept has_filtered_policy = not_void<typename T::policy_t> && std::same_as<typename T::policy_t, soa::FilteredIndexPolicy>;
1628
1629template <typename T>
1631
1632template <typename T>
1634
1635// FIXME: compatbility declaration to be removed
1636template <typename T>
1638
1639template <typename T>
1641
1642template <typename T>
1644
1646template <typename... Is>
1647static consteval auto extractBindings(framework::pack<Is...>)
1648{
1649 return framework::pack<typename Is::binding_t...>{};
1650}
1651
1653
1654template <typename T, typename C, typename Policy, bool OPT>
1655 requires std::same_as<Policy, framework::PreslicePolicySorted> && (o2::soa::is_binding_compatible_v<C, T>())
1656auto doSliceBy(T const* table, o2::framework::PresliceBase<C, Policy, OPT> const& container, int value)
1657{
1658 if constexpr (OPT) {
1659 if (container.isMissing()) {
1660 missingOptionalPreslice(getLabelFromType<std::decay_t<T>>().data(), container.bindingKey.key.c_str());
1661 }
1662 }
1663 uint64_t offset = 0;
1664 auto out = container.getSliceFor(value, table->asArrowTable(), offset);
1665 auto t = typename T::self_t({out}, offset);
1666 if (t.tableSize() != 0) {
1667 table->copyIndexBindings(t);
1668 t.bindInternalIndicesTo(table);
1669 }
1670 return t;
1671}
1672
1673template <soa::is_filtered_table T>
1674auto doSliceByHelper(T const* table, std::span<const int64_t> const& selection)
1675{
1676 auto t = soa::Filtered<typename T::base_t>({table->asArrowTable()}, selection);
1677 if (t.tableSize() != 0) {
1678 table->copyIndexBindings(t);
1679 t.bindInternalIndicesTo(table);
1680 t.intersectWithSelection(table->getSelectedRows()); // intersect filters
1681 }
1682 return t;
1683}
1684
1685template <soa::is_table T>
1686 requires(!soa::is_filtered_table<T>)
1687auto doSliceByHelper(T const* table, std::span<const int64_t> const& selection)
1688{
1689 auto t = soa::Filtered<T>({table->asArrowTable()}, selection);
1690 if (t.tableSize() != 0) {
1691 table->copyIndexBindings(t);
1692 t.bindInternalIndicesTo(table);
1693 }
1694 return t;
1695}
1696
1697template <typename T, typename C, typename Policy, bool OPT>
1698 requires std::same_as<Policy, framework::PreslicePolicyGeneral> && (o2::soa::is_binding_compatible_v<C, T>())
1699auto doSliceBy(T const* table, o2::framework::PresliceBase<C, Policy, OPT> const& container, int value)
1700{
1701 if constexpr (OPT) {
1702 if (container.isMissing()) {
1703 missingOptionalPreslice(getLabelFromType<std::decay_t<T>>().data(), container.bindingKey.key.c_str());
1704 }
1705 }
1706 auto selection = container.getSliceFor(value);
1707 return doSliceByHelper(table, selection);
1708}
1709
1710SelectionVector sliceSelection(std::span<int64_t const> const& mSelectedRows, int64_t nrows, uint64_t offset);
1711
1712template <soa::is_filtered_table T>
1713auto prepareFilteredSlice(T const* table, std::shared_ptr<arrow::Table> slice, uint64_t offset)
1714{
1715 if (offset >= static_cast<uint64_t>(table->tableSize())) {
1716 Filtered<typename T::base_t> fresult{{{slice}}, SelectionVector{}, 0};
1717 if (fresult.tableSize() != 0) {
1718 table->copyIndexBindings(fresult);
1719 }
1720 return fresult;
1721 }
1722 auto slicedSelection = sliceSelection(table->getSelectedRows(), slice->num_rows(), offset);
1723 Filtered<typename T::base_t> fresult{{{slice}}, std::move(slicedSelection), offset};
1724 if (fresult.tableSize() != 0) {
1725 table->copyIndexBindings(fresult);
1726 }
1727 return fresult;
1728}
1729
1730template <soa::is_filtered_table T, typename C, bool OPT>
1731 requires(o2::soa::is_binding_compatible_v<C, T>())
1733{
1734 if constexpr (OPT) {
1735 if (container.isMissing()) {
1736 missingOptionalPreslice(getLabelFromType<T>().data(), container.bindingKey.key.c_str());
1737 }
1738 }
1739 uint64_t offset = 0;
1740 auto slice = container.getSliceFor(value, table->asArrowTable(), offset);
1741 return prepareFilteredSlice(table, slice, offset);
1742}
1743
1744template <soa::is_table T>
1746{
1747 auto localCache = cache.ptr->getCacheFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
1748 auto [offset, count] = localCache.getSliceFor(value);
1749 auto t = typename T::self_t({table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count)}, static_cast<uint64_t>(offset));
1750 if (t.tableSize() != 0) {
1751 table->copyIndexBindings(t);
1752 }
1753 return t;
1754}
1755
1756template <soa::is_filtered_table T>
1758{
1759 auto localCache = cache.ptr->getCacheFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
1760 auto [offset, count] = localCache.getSliceFor(value);
1761 auto slice = table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count);
1762 return prepareFilteredSlice(table, slice, offset);
1763}
1764
1765template <soa::is_table T>
1767{
1768 auto localCache = cache.ptr->getCacheUnsortedFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
1769 if constexpr (soa::is_filtered_table<T>) {
1770 auto t = typename T::self_t({table->asArrowTable()}, localCache.getSliceFor(value));
1771 if (t.tableSize() != 0) {
1772 t.intersectWithSelection(table->getSelectedRows());
1773 table->copyIndexBindings(t);
1774 }
1775 return t;
1776 } else {
1777 auto t = Filtered<T>({table->asArrowTable()}, localCache.getSliceFor(value));
1778 if (t.tableSize() != 0) {
1779 table->copyIndexBindings(t);
1780 }
1781 return t;
1782 }
1783}
1784
1785template <with_originals T>
1787{
1788 return Filtered<T>({t.asArrowTable()}, selectionToVector(framework::expressions::createSelection(t.asArrowTable(), f)));
1789}
1790
1791arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, std::string_view label);
1792
1793template <typename D, typename O, typename IP, typename... C>
1794consteval auto base_iter(framework::pack<C...>&&) -> TableIterator<D, O, IP, C...>
1795{
1796}
1797
1798template <TableRef ref, typename... Ts>
1799 requires((sizeof...(Ts) > 0) && (soa::is_column<Ts> && ...))
1800consteval auto getColumns()
1801{
1802 return framework::pack<Ts...>{};
1803}
1804
1805template <TableRef ref, typename... Ts>
1806 requires((sizeof...(Ts) > 0) && !(soa::is_column<Ts> || ...) && (ref.origin_hash == "CONC"_h))
1807consteval auto getColumns()
1808{
1809 return framework::full_intersected_pack_t<typename Ts::columns_t...>{};
1810}
1811
1812template <TableRef ref, typename... Ts>
1813 requires((sizeof...(Ts) > 0) && !(soa::is_column<Ts> || ...) && (ref.origin_hash != "CONC"_h))
1814consteval auto getColumns()
1815{
1816 return framework::concatenated_pack_unique_t<typename Ts::columns_t...>{};
1817}
1818
1819template <TableRef ref, typename... Ts>
1820 requires(sizeof...(Ts) == 0 && soa::has_metadata<aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>>)
1821consteval auto getColumns()
1822{
1823 return typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{};
1824}
1825
1826template <TableRef ref, typename... Ts>
1827 requires((sizeof...(Ts) == 0) || (o2::soa::is_column<Ts> && ...))
1828consteval auto computeOriginals()
1829{
1830 return std::array<TableRef, 1>{ref};
1831}
1832
1833template <TableRef ref, typename... Ts>
1834 requires((sizeof...(Ts) > 0) && (!(o2::soa::is_column<Ts> && ...)))
1835consteval auto computeOriginals()
1836{
1837 return o2::soa::mergeOriginals<Ts...>();
1838}
1839
1840// template <size_t N, std::array<TableRef, N> refs>
1841// consteval auto commonOrigin()
1842// {
1843// return (refs | std::ranges::views::filter([](TableRef const& r) { return (!(r.origin_hash == "DYN"_h || r.origin_hash == "IDX"_h)); })).front().origin_hash;
1844// }
1845
1848template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O, typename... Ts>
1850{
1851 public:
1852 static constexpr const auto ref = TableRef{L::hash, D::hash, O::hash, o2::aod::version(D::str)};
1853 using self_t = Table<L, D, O, Ts...>;
1855
1856 static constexpr const auto originals = computeOriginals<ref, Ts...>();
1857 static constexpr const auto originalLabels = []<size_t N, std::array<TableRef, N> refs, size_t... Is>(std::index_sequence<Is...>) {
1858 return std::array<const char*, N>{o2::aod::label<refs[Is]>()...};
1859 }.template operator()<originals.size(), originals>(std::make_index_sequence<originals.size()>());
1860 static constexpr const uint32_t binding_origin = originals[0].origin_hash; // commonOrigin<originals.size(), originals>();
1862
1863 template <size_t N, std::array<TableRef, N> bindings>
1864 requires(ref.origin_hash == "CONC"_h)
1865 static consteval auto isIndexTargetOf()
1866 {
1867 return false;
1868 }
1869
1870 template <size_t N, std::array<TableRef, N> bindings>
1871 requires(ref.origin_hash == "JOIN"_h)
1872 static consteval auto isIndexTargetOf()
1873 {
1874 return std::ranges::any_of(self_t::originals,
1875 [](TableRef const& r) {
1876 return std::ranges::any_of(bindings, [&r](TableRef const& b) { return b == r; });
1877 });
1878 }
1879
1880 template <size_t N, std::array<TableRef, N> bindings>
1881 requires(!(ref.origin_hash == "CONC"_h || ref.origin_hash == "JOIN"_h))
1882 static consteval auto isIndexTargetOf()
1883 {
1884 return std::find(bindings.begin(), bindings.end(), self_t::ref) != bindings.end();
1885 }
1886
1887 template <TableRef r>
1888 static consteval bool hasOriginal()
1889 {
1890 return std::ranges::any_of(originals, [](TableRef const& o) { return o.desc_hash == r.desc_hash; });
1891 }
1892
1893 using columns_t = decltype(getColumns<ref, Ts...>());
1894
1897
1900 template <typename IP>
1901 using base_iterator = decltype(base_iter<D, O, IP>(columns_t{}));
1902
1903 template <typename IP, typename Parent, typename... T>
1905 using columns_t = typename Parent::columns_t;
1906 using external_index_columns_t = typename Parent::external_index_columns_t;
1908 // static constexpr const std::array<TableRef, sizeof...(T)> originals{T::ref...};
1909 static constexpr auto originals = Parent::originals;
1910 using policy_t = IP;
1911 using parent_t = Parent;
1912
1914
1915 TableIteratorBase(arrow::ChunkedArray* columnData[framework::pack_size(columns_t{})], IP&& policy)
1916 : base_iterator<IP>(columnData, std::forward<decltype(policy)>(policy))
1917 {
1918 }
1919
1920 template <typename P, typename... Os>
1922 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1923 {
1924 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<IP>>(other);
1925 return *this;
1926 }
1927
1928 template <typename P>
1930 {
1931 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<IP>>(other);
1932 return *this;
1933 }
1934
1935 template <typename P>
1937 requires std::same_as<IP, DefaultIndexPolicy>
1938 {
1939 static_cast<base_iterator<IP>&>(*this) = static_cast<base_iterator<FilteredIndexPolicy>>(other);
1940 return *this;
1941 }
1942
1943 template <typename P, typename O1, typename... Os>
1945 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1946 {
1947 *this = other;
1948 }
1949
1950 template <typename P, typename O1, typename... Os>
1952 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1953 {
1954 *this = other;
1955 }
1956
1957 template <typename P>
1962
1963 template <typename P>
1965 {
1966 *this = other;
1967 }
1968
1969 template <typename P>
1971 requires std::same_as<IP, DefaultIndexPolicy>
1972 {
1973 *this = other;
1974 }
1975
1977 {
1978 this->mRowIndex = other.index;
1979 return *this;
1980 }
1981 template <typename P>
1983 {
1984 this->mRowIndex = other.mRowIndex;
1985 }
1986
1987 template <typename P, typename... Os>
1989 requires std::same_as<typename P::table_t, typename Parent::table_t>
1990 {
1991 this->mRowIndex = other.mRowIndex;
1992 }
1993
1994 template <typename TI>
1995 auto getId() const
1996 {
1997 using decayed = std::decay_t<TI>;
1998 if constexpr (framework::has_type<decayed>(bindings_pack_t{})) { // index to another table
1999 constexpr auto idx = framework::has_type_at_v<decayed>(bindings_pack_t{});
2001 } else if constexpr (std::same_as<decayed, Parent>) { // self index
2002 return this->globalIndex();
2003 } else if constexpr (is_indexing_column<decayed>) { // soa::Index<>
2004 return this->globalIndex();
2005 } else {
2006 return static_cast<int32_t>(-1);
2007 }
2008 }
2009
2010 template <typename CD, typename... CDArgs>
2011 auto getDynamicColumn() const
2012 {
2013 using decayed = std::decay_t<CD>;
2014 static_assert(is_dynamic_t<decayed>(), "Requested column is not a dynamic column");
2015 return static_cast<decayed>(*this).template getDynamicValue<CDArgs...>();
2016 }
2017
2018 template <typename B, typename CC>
2019 auto getValue() const
2020 {
2021 using COL = std::decay_t<CC>;
2022 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");
2023 return static_cast<B>(static_cast<COL>(*this).get());
2024 }
2025
2026 template <typename B, typename... CCs>
2027 std::array<B, sizeof...(CCs)> getValues() const
2028 {
2029 static_assert(std::same_as<B, float> || std::same_as<B, double>, "The common return type should be float or double");
2030 return {getValue<B, CCs>()...};
2031 }
2032
2033 using IP::size;
2034
2035 using base_iterator<IP>::operator++;
2036
2039 {
2040 TableIteratorBase copy = *this;
2041 copy.moveByIndex(inc);
2042 return copy;
2043 }
2044
2046 {
2047 return operator+(-dec);
2048 }
2049
2051 {
2052 return *this;
2053 }
2054 };
2055
2056 template <typename IP, typename Parent, typename... T>
2058
2059 template <typename IP, typename Parent>
2060 static consteval auto full_iter()
2061 {
2062 if constexpr (sizeof...(Ts) == 0) {
2064 } else {
2065 if constexpr ((o2::soa::is_column<Ts> && ...)) {
2067 } else {
2068 return iterator_template<IP, Parent, Ts...>{};
2069 }
2070 }
2071 }
2072
2073 template <typename IP, typename Parent>
2074 using iterator_template_o = decltype(full_iter<IP, Parent>());
2075
2078
2082
2083 static constexpr auto hashes()
2084 {
2085 return []<typename... C>(framework::pack<C...>) { return std::set{{C::hash...}}; }(columns_t{});
2086 }
2087
2088 Table(std::shared_ptr<arrow::Table> table, uint64_t offset = 0)
2089 : mTable(table),
2090 mOffset(offset),
2091 mEnd{table->num_rows()}
2092 {
2093 if (mTable->num_rows() == 0) {
2094 for (size_t ci = 0; ci < framework::pack_size(columns_t{}); ++ci) {
2095 mColumnChunks[ci] = nullptr;
2096 }
2097 mBegin = mEnd;
2098 } else {
2099 auto lookups = [this]<typename... C>(framework::pack<C...>) -> std::array<arrow::ChunkedArray*, framework::pack_size(columns_t{})> { return {lookupColumn<C>()...}; }(columns_t{});
2100 for (size_t ci = 0; ci < framework::pack_size(columns_t{}); ++ci) {
2101 mColumnChunks[ci] = lookups[ci];
2102 }
2103 mBegin = unfiltered_iterator{mColumnChunks, {table->num_rows(), offset}};
2104 mBegin.bindInternalIndices(this);
2105 }
2106 }
2107
2108 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
2109 requires(ref.origin_hash != "CONC"_h)
2110 : Table(ArrowHelpers::joinTables(std::move(tables), std::span{originalLabels}), offset)
2111 {
2112 }
2113
2114 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
2115 requires(ref.origin_hash == "CONC"_h)
2116 : Table(ArrowHelpers::concatTables(std::move(tables)), offset)
2117 {
2118 }
2119
2120 template <typename Key>
2121 inline arrow::ChunkedArray* getIndexToKey()
2122 {
2123 constexpr auto map = []<typename... Cs>(framework::pack<Cs...>) {
2124 return std::array<bool, sizeof...(Cs)>{[]() {
2125 if constexpr (requires { Cs::index_targets.size(); }) {
2126 return Key::template isIndexTargetOf<Cs::index_targets.size(), Cs::index_targets>();
2127 } else {
2128 return false;
2129 }
2130 }()...};
2132 constexpr auto pos = std::find(map.begin(), map.end(), true);
2133 if constexpr (pos != map.end()) {
2134 return mColumnChunks[std::distance(map.begin(), pos)];
2135 } else {
2136 static_assert(framework::always_static_assert_v<Key>, "This table does not have an index to given Key");
2137 }
2138 }
2139
2141 {
2142 return mBegin;
2143 }
2144
2145 auto const& cached_begin() const
2146 {
2147 return mBegin;
2148 }
2149
2151 {
2152 return unfiltered_iterator(mBegin);
2153 }
2154
2156 {
2157 return RowViewSentinel{mEnd};
2158 }
2159
2160 filtered_iterator filtered_begin(std::span<int64_t const> selection)
2161 {
2162 // Note that the FilteredIndexPolicy will never outlive the selection which
2163 // is held by the table, so we are safe passing the bare pointer. If it does it
2164 // means that the iterator on a table is outliving the table itself, which is
2165 // a bad idea.
2166 return filtered_iterator(mColumnChunks, {selection, mTable->num_rows(), mOffset});
2167 }
2168
2169 iterator iteratorAt(uint64_t i) const
2170 {
2171 return rawIteratorAt(i);
2172 }
2173
2175 {
2176 auto it = mBegin;
2177 it.setCursor(i);
2178 return it;
2179 }
2180
2182 {
2183 return unfiltered_const_iterator(mBegin);
2184 }
2185
2186 [[nodiscard]] RowViewSentinel end() const
2187 {
2188 return RowViewSentinel{mEnd};
2189 }
2190
2192 [[nodiscard]] std::shared_ptr<arrow::Table> asArrowTable() const
2193 {
2194 return mTable;
2195 }
2197 auto offset() const
2198 {
2199 return mOffset;
2200 }
2202 [[nodiscard]] int64_t size() const
2203 {
2204 return mTable->num_rows();
2205 }
2206
2207 [[nodiscard]] int64_t tableSize() const
2208 {
2209 return size();
2210 }
2211
2214 template <typename... TA>
2215 void bindExternalIndices(TA*... current)
2216 {
2217 ([this](TA* cur) {
2218 if constexpr (binding_origin == TA::binding_origin) {
2219 mBegin.bindExternalIndex(cur);
2220 }
2221 }(current),
2222 ...);
2223 }
2224
2225 template <typename TA>
2226 void bindExternalIndex(TA* current)
2227 {
2228 mBegin.bindExternalIndex(current); // unchecked binding for the derived tables
2229 }
2230
2231 template <typename I>
2233 {
2234 mBegin.bindInternalIndices(ptr);
2235 }
2236
2241
2242 template <typename... Cs>
2244 {
2245 (static_cast<Cs>(mBegin).setCurrentRaw(binding), ...);
2246 }
2247
2248 void bindExternalIndicesRaw(std::vector<o2::soa::Binding>&& ptrs)
2249 {
2250 mBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
2251 }
2252
2253 template <typename T, typename... Cs>
2255 {
2256 dest.bindExternalIndicesRaw(mBegin.getIndexBindings());
2257 }
2258
2259 template <typename T>
2260 void copyIndexBindings(T& dest) const
2261 {
2263 }
2264
2266 {
2267 auto t = o2::soa::select(*this, f);
2269 return t;
2270 }
2271
2273 {
2274 return doSliceByCached(this, node, value, cache);
2275 }
2276
2281
2282 template <typename T1, typename Policy, bool OPT>
2284 {
2285 return doSliceBy(this, container, value);
2286 }
2287
2288 auto rawSlice(uint64_t start, uint64_t end) const
2289 {
2290 return self_t{mTable->Slice(start, end - start + 1), start};
2291 }
2292
2293 auto emptySlice() const
2294 {
2295 return self_t{mTable->Slice(0, 0), 0};
2296 }
2297
2298 private:
2299 template <typename T>
2300 arrow::ChunkedArray* lookupColumn()
2301 {
2302 if constexpr (soa::is_persistent_column<T>) {
2303 auto label = T::columnLabel();
2304 return getIndexFromLabel(mTable.get(), label);
2305 } else {
2306 return nullptr;
2307 }
2308 }
2309 std::shared_ptr<arrow::Table> mTable = nullptr;
2310 uint64_t mOffset = 0;
2311 // Cached pointers to the ChunkedArray associated to a column
2312 arrow::ChunkedArray* mColumnChunks[framework::pack_size(columns_t{})];
2313 RowViewSentinel mEnd;
2314 iterator mBegin;
2315};
2316
2317template <uint32_t D, soa::is_column... C>
2319
2320void getterNotFound(const char* targetColumnLabel);
2321void emptyColumnLabel();
2322
2323namespace row_helpers
2324{
2325template <typename R, typename T, typename C>
2326R getColumnValue(const T& rowIterator)
2327{
2328 return static_cast<R>(static_cast<C>(rowIterator).get());
2329}
2330
2331namespace
2332{
2333template <typename R, typename T>
2334using ColumnGetterFunction = R (*)(const T&);
2335
2336template <typename T, typename R>
2338 // lambda is callable without additional free args
2339 framework::pack_size(typename T::bindings_t{}) == framework::pack_size(typename T::callable_t::args{}) &&
2340 requires(T t) {
2341 { t.get() } -> std::convertible_to<R>;
2342 };
2343
2344template <typename T, typename R>
2345concept persistent_with_common_getter = is_persistent_v<T> && requires(T t) {
2346 { t.get() } -> std::convertible_to<R>;
2347};
2348
2349template <typename R, typename T, persistent_with_common_getter<R> C>
2350ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& targetColumnLabel)
2351{
2352 return targetColumnLabel == C::columnLabel() ? &getColumnValue<R, T, C> : nullptr;
2353}
2354
2355template <typename R, typename T, dynamic_with_common_getter<R> C>
2356ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& targetColumnLabel)
2357{
2358 std::string_view columnLabel(C::columnLabel());
2359
2360 // allows user to use consistent formatting (with prefix) of all column labels
2361 // by default there isn't 'f' prefix for dynamic column labels
2362 if (targetColumnLabel.starts_with("f") && targetColumnLabel.substr(1) == columnLabel) {
2363 return &getColumnValue<R, T, C>;
2364 }
2365
2366 // check also exact match if user is aware of prefix missing
2367 if (targetColumnLabel == columnLabel) {
2368 return &getColumnValue<R, T, C>;
2369 }
2370
2371 return nullptr;
2372}
2373
2374template <typename R, typename T, typename... Cs>
2375ColumnGetterFunction<R, T> getColumnGetterByLabel(o2::framework::pack<Cs...>, const std::string_view& targetColumnLabel)
2376{
2377 ColumnGetterFunction<R, T> func;
2378
2379 (void)((func = createGetterPtr<R, T, Cs>(targetColumnLabel), func) || ...);
2380
2381 if (!func) {
2382 getterNotFound(targetColumnLabel.data());
2383 }
2384
2385 return func;
2386}
2387
2388template <typename T, typename R>
2389using 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;
2390} // namespace
2391
2392template <typename R, typename T>
2393ColumnGetterFunction<R, typename T::iterator> getColumnGetterByLabel(const std::string_view& targetColumnLabel)
2394{
2395 using TypesWithCommonGetter = o2::framework::selected_pack_multicondition<with_common_getter_t, framework::pack<R>, typename T::columns_t>;
2396
2397 if (targetColumnLabel.size() == 0) {
2399 }
2400
2401 return getColumnGetterByLabel<R, typename T::iterator>(TypesWithCommonGetter{}, targetColumnLabel);
2402}
2403} // namespace row_helpers
2404} // namespace o2::soa
2405
2406namespace o2::aod
2407{
2408// If you get an error about not satisfying is_origin_hash, you need to add
2409// an entry here.
2411O2ORIGIN("AOD1");
2412O2ORIGIN("AOD2");
2413// O2ORIGIN("DYN");
2414// O2ORIGIN("IDX");
2415// O2ORIGIN("ATIM");
2416O2ORIGIN("JOIN");
2417O2HASH("JOIN/0");
2418O2ORIGIN("CONC");
2419O2HASH("CONC/0");
2420O2ORIGIN("TEST");
2421O2HASH("TEST/0");
2422} // namespace o2::aod
2423
2424namespace
2425{
2426template <typename T>
2427consteval static std::string_view namespace_prefix()
2428{
2429 constexpr auto name = o2::framework::type_name<T>();
2430 const auto pos = name.rfind(std::string_view{":"});
2431 return name.substr(0, pos + 1);
2432}
2433} // namespace
2434
2435#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \
2436 template <> \
2437 struct EquivalentIndexNG<o2::aod::Hash<_Base_::ref.desc_hash>, o2::aod::Hash<_Equiv_::ref.desc_hash>> { \
2438 constexpr static bool value = true; \
2439 }
2440
2441#define DECLARE_EQUIVALENT_FOR_INDEX_NG(_Base_, _Equiv_) \
2442 template <> \
2443 struct EquivalentIndexNG<o2::aod::Hash<_Base_ ""_h>, o2::aod::Hash<_Equiv_ ""_h>> { \
2444 constexpr static bool value = true; \
2445 }
2446
2447#define DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
2448 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2449 static constexpr const char* mLabel = _Label_; \
2450 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2451 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2452 using base = o2::soa::Column<_Type_, _Name_>; \
2453 using type = _Type_; \
2454 using column_t = _Name_; \
2455 _Name_(arrow::ChunkedArray const* column) \
2456 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2457 { \
2458 } \
2459 \
2460 _Name_() = default; \
2461 _Name_(_Name_ const& other) = default; \
2462 _Name_& operator=(_Name_ const& other) = default; \
2463 \
2464 decltype(auto) _Getter_() const \
2465 { \
2466 return *mColumnIterator; \
2467 } \
2468 \
2469 decltype(auto) get() const \
2470 { \
2471 return _Getter_(); \
2472 } \
2473 }; \
2474 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2475
2476#define DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2477 struct _Name_ : o2::soa::Column<std::span<std::byte>, _Name_> { \
2478 static constexpr const char* mLabel = _Label_; \
2479 static constexpr const char* query = _CCDBQuery_; \
2480 static constexpr const uint32_t hash = crc32(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2481 using base = o2::soa::Column<std::span<std::byte>, _Name_>; \
2482 using type = std::span<std::byte>; \
2483 using column_t = _Name_; \
2484 _Name_(arrow::ChunkedArray const* column) \
2485 : o2::soa::Column<std::span<std::byte>, _Name_>(o2::soa::ColumnIterator<std::span<std::byte>>(column)) \
2486 { \
2487 } \
2488 \
2489 _Name_() = default; \
2490 _Name_(_Name_ const& other) = default; \
2491 _Name_& operator=(_Name_ const& other) = default; \
2492 \
2493 decltype(auto) _Getter_() const \
2494 { \
2495 if constexpr (std::same_as<_ConcreteType_, std::span<std::byte>>) { \
2496 return *mColumnIterator; \
2497 } else { \
2498 static std::byte* payload = nullptr; \
2499 static _ConcreteType_* deserialised = nullptr; \
2500 static TClass* c = TClass::GetClass(#_ConcreteType_); \
2501 auto span = *mColumnIterator; \
2502 if (payload != (std::byte*)span.data()) { \
2503 payload = (std::byte*)span.data(); \
2504 delete deserialised; \
2505 TBufferFile f(TBufferFile::EMode::kRead, span.size(), (char*)span.data(), kFALSE); \
2506 deserialised = (_ConcreteType_*)soa::extractCCDBPayload((char*)payload, span.size(), c, "ccdb_object"); \
2507 } \
2508 return *deserialised; \
2509 } \
2510 } \
2511 \
2512 decltype(auto) \
2513 get() const \
2514 { \
2515 return _Getter_(); \
2516 } \
2517 };
2518
2519#define DECLARE_SOA_CCDB_COLUMN(_Name_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2520 DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, "f" #_Name_, _Getter_, _ConcreteType_, _CCDBQuery_)
2521
2522#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_) \
2523 DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_)
2524
2527#define MAKEINT(_Size_) uint##_Size_##_t
2528
2529#define DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, _Label_) \
2530 struct _Name_ : o2::soa::Column<MAKEINT(_Size_), _Name_> { \
2531 static constexpr const char* mLabel = _Label_; \
2532 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2533 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2534 using base = o2::soa::Column<MAKEINT(_Size_), _Name_>; \
2535 using type = MAKEINT(_Size_); \
2536 _Name_(arrow::ChunkedArray const* column) \
2537 : o2::soa::Column<type, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2538 { \
2539 } \
2540 \
2541 _Name_() = default; \
2542 _Name_(_Name_ const& other) = default; \
2543 _Name_& operator=(_Name_ const& other) = default; \
2544 \
2545 decltype(auto) _Getter_##_raw() const \
2546 { \
2547 return *mColumnIterator; \
2548 } \
2549 \
2550 bool _Getter_##_bit(int bit) const \
2551 { \
2552 return (*mColumnIterator & (static_cast<type>(1) << bit)) >> bit; \
2553 } \
2554 }; \
2555 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<MAKEINT(_Size_)>() }
2556
2557#define DECLARE_SOA_BITMAP_COLUMN(_Name_, _Getter_, _Size_) \
2558 DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, "f" #_Name_)
2559
2562#define DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_, _Expression_) \
2563 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2564 static constexpr const char* mLabel = _Label_; \
2565 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2566 using base = o2::soa::Column<_Type_, _Name_>; \
2567 using type = _Type_; \
2568 using column_t = _Name_; \
2569 using spawnable_t = std::true_type; \
2570 _Name_(arrow::ChunkedArray const* column) \
2571 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2572 { \
2573 } \
2574 \
2575 _Name_() = default; \
2576 _Name_(_Name_ const& other) = default; \
2577 _Name_& operator=(_Name_ const& other) = default; \
2578 \
2579 decltype(auto) _Getter_() const \
2580 { \
2581 return *mColumnIterator; \
2582 } \
2583 \
2584 decltype(auto) get() const \
2585 { \
2586 return _Getter_(); \
2587 } \
2588 \
2589 static o2::framework::expressions::Projector Projector() \
2590 { \
2591 return _Expression_; \
2592 } \
2593 }; \
2594 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2595
2596#define DECLARE_SOA_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Expression_) \
2597 DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_, _Expression_);
2598
2601#define DECLARE_SOA_CONFIGURABLE_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Label_) \
2602 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2603 static constexpr const char* mLabel = _Label_; \
2604 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2605 static constexpr const int32_t mHash = _Label_ ""_h; \
2606 using base = o2::soa::Column<_Type_, _Name_>; \
2607 using type = _Type_; \
2608 using column_t = _Name_; \
2609 using spawnable_t = std::true_type; \
2610 _Name_(arrow::ChunkedArray const* column) \
2611 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2612 { \
2613 } \
2614 \
2615 _Name_() = default; \
2616 _Name_(_Name_ const& other) = default; \
2617 _Name_& operator=(_Name_ const& other) = default; \
2618 \
2619 decltype(auto) _Getter_() const \
2620 { \
2621 return *mColumnIterator; \
2622 } \
2623 \
2624 decltype(auto) get() const \
2625 { \
2626 return _Getter_(); \
2627 } \
2628 }; \
2629 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2630
2649
2651
2652template <o2::soa::is_table T>
2653consteval auto getIndexTargets()
2654{
2655 return T::originals;
2656}
2657
2658#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2659 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2660 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2661 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2662 static constexpr const char* mLabel = "fIndexSlice" _Label_ _Suffix_; \
2663 static constexpr const uint32_t hash = 0; \
2664 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2665 using type = _Type_[2]; \
2666 using column_t = _Name_##IdSlice; \
2667 using binding_t = _Table_; \
2668 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2669 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2670 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2671 { \
2672 } \
2673 \
2674 _Name_##IdSlice() = default; \
2675 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2676 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2677 std::array<_Type_, 2> inline getIds() const \
2678 { \
2679 return _Getter_##Ids(); \
2680 } \
2681 \
2682 bool has_##_Getter_() const \
2683 { \
2684 auto a = *mColumnIterator; \
2685 return a[0] >= 0 && a[1] >= 0; \
2686 } \
2687 \
2688 std::array<_Type_, 2> _Getter_##Ids() const \
2689 { \
2690 auto a = *mColumnIterator; \
2691 return std::array{a[0], a[1]}; \
2692 } \
2693 \
2694 template <typename T> \
2695 auto _Getter_##_as() const \
2696 { \
2697 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2698 o2::soa::notBoundTable(#_Table_); \
2699 } \
2700 auto t = mBinding.get<T>(); \
2701 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2702 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2703 } \
2704 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2705 return t->emptySlice(); \
2706 } \
2707 auto a = *mColumnIterator; \
2708 auto r = t->rawSlice(a[0], a[1]); \
2709 t->copyIndexBindings(r); \
2710 r.bindInternalIndicesTo(t); \
2711 return r; \
2712 } \
2713 \
2714 auto _Getter_() const \
2715 { \
2716 return _Getter_##_as<binding_t>(); \
2717 } \
2718 \
2719 template <typename T> \
2720 bool setCurrent(T const* current) \
2721 { \
2722 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2723 assert(current != nullptr); \
2724 this->mBinding.bind(current); \
2725 return true; \
2726 } \
2727 return false; \
2728 } \
2729 \
2730 bool setCurrentRaw(o2::soa::Binding current) \
2731 { \
2732 this->mBinding = current; \
2733 return true; \
2734 } \
2735 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2736 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2737 o2::soa::Binding mBinding; \
2738 };
2739
2740#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_)
2741#define DECLARE_SOA_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2742#define DECLARE_SOA_SLICE_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2743
2745#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2746 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
2747 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2748 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2749 static constexpr const char* mLabel = "fIndexArray" _Label_ _Suffix_; \
2750 static constexpr const uint32_t hash = 0; \
2751 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
2752 using type = std::vector<_Type_>; \
2753 using column_t = _Name_##Ids; \
2754 using binding_t = _Table_; \
2755 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2756 _Name_##Ids(arrow::ChunkedArray const* column) \
2757 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
2758 { \
2759 } \
2760 \
2761 _Name_##Ids() = default; \
2762 _Name_##Ids(_Name_##Ids const& other) = default; \
2763 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
2764 \
2765 gsl::span<const _Type_> inline getIds() const \
2766 { \
2767 return _Getter_##Ids(); \
2768 } \
2769 \
2770 gsl::span<const _Type_> _Getter_##Ids() const \
2771 { \
2772 return *mColumnIterator; \
2773 } \
2774 \
2775 bool has_##_Getter_() const \
2776 { \
2777 return !(*mColumnIterator).empty(); \
2778 } \
2779 \
2780 template <soa::is_table T> \
2781 auto _Getter_##_as() const \
2782 { \
2783 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2784 o2::soa::notBoundTable(#_Table_); \
2785 } \
2786 auto t = mBinding.get<T>(); \
2787 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2788 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2789 } \
2790 auto result = std::vector<typename T::unfiltered_iterator>(); \
2791 result.reserve((*mColumnIterator).size()); \
2792 for (auto& i : *mColumnIterator) { \
2793 result.emplace_back(t->rawIteratorAt(i)); \
2794 } \
2795 return result; \
2796 } \
2797 \
2798 template <soa::is_filtered_table T> \
2799 auto filtered_##_Getter_##_as() const \
2800 { \
2801 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2802 o2::soa::notBoundTable(#_Table_); \
2803 } \
2804 auto t = mBinding.get<T>(); \
2805 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2806 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2807 } \
2808 auto result = std::vector<typename T::iterator>(); \
2809 result.reserve((*mColumnIterator).size()); \
2810 for (auto const& i : *mColumnIterator) { \
2811 auto pos = t->isInSelectedRows(i); \
2812 if (pos > 0) { \
2813 result.emplace_back(t->iteratorAt(pos)); \
2814 } \
2815 } \
2816 return result; \
2817 } \
2818 \
2819 auto _Getter_() const \
2820 { \
2821 return _Getter_##_as<binding_t>(); \
2822 } \
2823 \
2824 template <typename T> \
2825 auto _Getter_##_first_as() const \
2826 { \
2827 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2828 o2::soa::notBoundTable(#_Table_); \
2829 } \
2830 auto t = mBinding.get<T>(); \
2831 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2832 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2833 } \
2834 return t->rawIteratorAt((*mColumnIterator)[0]); \
2835 } \
2836 \
2837 template <typename T> \
2838 auto _Getter_##_last_as() const \
2839 { \
2840 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2841 o2::soa::notBoundTable(#_Table_); \
2842 } \
2843 auto t = mBinding.get<T>(); \
2844 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2845 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2846 } \
2847 return t->rawIteratorAt((*mColumnIterator).back()); \
2848 } \
2849 \
2850 auto _Getter_first() const \
2851 { \
2852 return _Getter_##_first_as<binding_t>(); \
2853 } \
2854 \
2855 auto _Getter_last() const \
2856 { \
2857 return _Getter_##_last_as<binding_t>(); \
2858 } \
2859 \
2860 template <typename T> \
2861 bool setCurrent(T const* current) \
2862 { \
2863 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2864 assert(current != nullptr); \
2865 this->mBinding.bind(current); \
2866 return true; \
2867 } \
2868 return false; \
2869 } \
2870 \
2871 bool setCurrentRaw(o2::soa::Binding current) \
2872 { \
2873 this->mBinding = current; \
2874 return true; \
2875 } \
2876 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2877 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2878 o2::soa::Binding mBinding; \
2879 };
2880
2881#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_)
2882#define DECLARE_SOA_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2883#define DECLARE_SOA_ARRAY_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2884
2886#define DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2887 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2888 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2889 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2890 static constexpr const char* mLabel = "fIndex" _Label_ _Suffix_; \
2891 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2892 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2893 using type = _Type_; \
2894 using column_t = _Name_##Id; \
2895 using binding_t = _Table_; \
2896 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2897 _Name_##Id(arrow::ChunkedArray const* column) \
2898 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2899 { \
2900 } \
2901 \
2902 _Name_##Id() = default; \
2903 _Name_##Id(_Name_##Id const& other) = default; \
2904 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2905 type inline getId() const \
2906 { \
2907 return _Getter_##Id(); \
2908 } \
2909 \
2910 type _Getter_##Id() const \
2911 { \
2912 return *mColumnIterator; \
2913 } \
2914 \
2915 bool has_##_Getter_() const \
2916 { \
2917 return *mColumnIterator >= 0; \
2918 } \
2919 \
2920 template <typename T> \
2921 auto _Getter_##_as() const \
2922 { \
2923 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2924 o2::soa::notBoundTable(#_Table_); \
2925 } \
2926 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2927 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2928 } \
2929 auto t = mBinding.get<T>(); \
2930 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2931 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2932 } \
2933 return t->rawIteratorAt(*mColumnIterator); \
2934 } \
2935 \
2936 auto _Getter_() const \
2937 { \
2938 return _Getter_##_as<binding_t>(); \
2939 } \
2940 \
2941 template <typename T> \
2942 bool setCurrent(T* current) \
2943 { \
2944 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2945 assert(current != nullptr); \
2946 this->mBinding.bind(current); \
2947 return true; \
2948 } \
2949 return false; \
2950 } \
2951 \
2952 bool setCurrentRaw(o2::soa::Binding current) \
2953 { \
2954 this->mBinding = current; \
2955 return true; \
2956 } \
2957 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2958 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2959 o2::soa::Binding mBinding; \
2960 }; \
2961 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_ _Suffix_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2962
2963#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2964#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2965#define DECLARE_SOA_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2966
2968#define DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2969 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2970 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2971 static constexpr const char* mLabel = "fIndex" _Label_; \
2972 static constexpr const uint32_t hash = compile_time_hash(namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2973 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2974 using type = _Type_; \
2975 using column_t = _Name_##Id; \
2976 using self_index_t = std::true_type; \
2977 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2978 _Name_##Id(arrow::ChunkedArray const* column) \
2979 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2980 { \
2981 } \
2982 \
2983 _Name_##Id() = default; \
2984 _Name_##Id(_Name_##Id const& other) = default; \
2985 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2986 type inline getId() const \
2987 { \
2988 return _Getter_##Id(); \
2989 } \
2990 \
2991 type _Getter_##Id() const \
2992 { \
2993 return *mColumnIterator; \
2994 } \
2995 \
2996 bool has_##_Getter_() const \
2997 { \
2998 return *mColumnIterator >= 0; \
2999 } \
3000 \
3001 template <typename T> \
3002 auto _Getter_##_as() const \
3003 { \
3004 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
3005 o2::soa::accessingInvalidIndexFor(#_Getter_); \
3006 } \
3007 auto t = mBinding.get<T>(); \
3008 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3009 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3010 } \
3011 return t->rawIteratorAt(*mColumnIterator); \
3012 } \
3013 \
3014 bool setCurrentRaw(o2::soa::Binding current) \
3015 { \
3016 this->mBinding = current; \
3017 return true; \
3018 } \
3019 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3020 o2::soa::Binding mBinding; \
3021 }; \
3022 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
3023
3024#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3025#define DECLARE_SOA_SELF_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
3027#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
3028 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
3029 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
3030 static constexpr const char* mLabel = "fIndexSlice" _Label_; \
3031 static constexpr const uint32_t hash = 0; \
3032 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
3033 using type = _Type_[2]; \
3034 using column_t = _Name_##IdSlice; \
3035 using self_index_t = std::true_type; \
3036 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
3037 _Name_##IdSlice(arrow::ChunkedArray const* column) \
3038 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
3039 { \
3040 } \
3041 \
3042 _Name_##IdSlice() = default; \
3043 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
3044 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
3045 std::array<_Type_, 2> inline getIds() const \
3046 { \
3047 return _Getter_##Ids(); \
3048 } \
3049 \
3050 bool has_##_Getter_() const \
3051 { \
3052 auto a = *mColumnIterator; \
3053 return a[0] >= 0 && a[1] >= 0; \
3054 } \
3055 \
3056 std::array<_Type_, 2> _Getter_##Ids() const \
3057 { \
3058 auto a = *mColumnIterator; \
3059 return std::array{a[0], a[1]}; \
3060 } \
3061 \
3062 template <typename T> \
3063 auto _Getter_##_as() const \
3064 { \
3065 auto t = mBinding.get<T>(); \
3066 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3067 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3068 } \
3069 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
3070 return t->emptySlice(); \
3071 } \
3072 auto a = *mColumnIterator; \
3073 auto r = t->rawSlice(a[0], a[1]); \
3074 t->copyIndexBindings(r); \
3075 r.bindInternalIndicesTo(t); \
3076 return r; \
3077 } \
3078 \
3079 bool setCurrentRaw(o2::soa::Binding current) \
3080 { \
3081 this->mBinding = current; \
3082 return true; \
3083 } \
3084 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3085 o2::soa::Binding mBinding; \
3086 };
3087
3088#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3089#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3091#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
3092 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
3093 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
3094 static constexpr const char* mLabel = "fIndexArray" _Label_; \
3095 static constexpr const uint32_t hash = 0; \
3096 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
3097 using type = std::vector<_Type_>; \
3098 using column_t = _Name_##Ids; \
3099 using self_index_t = std::true_type; \
3100 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
3101 _Name_##Ids(arrow::ChunkedArray const* column) \
3102 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
3103 { \
3104 } \
3105 \
3106 _Name_##Ids() = default; \
3107 _Name_##Ids(_Name_##Ids const& other) = default; \
3108 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
3109 gsl::span<const _Type_> inline getIds() const \
3110 { \
3111 return _Getter_##Ids(); \
3112 } \
3113 \
3114 gsl::span<const _Type_> _Getter_##Ids() const \
3115 { \
3116 return *mColumnIterator; \
3117 } \
3118 \
3119 bool has_##_Getter_() const \
3120 { \
3121 return !(*mColumnIterator).empty(); \
3122 } \
3123 \
3124 template <typename T> \
3125 auto _Getter_##_as() const \
3126 { \
3127 auto t = mBinding.get<T>(); \
3128 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3129 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3130 } \
3131 auto result = std::vector<typename T::unfiltered_iterator>(); \
3132 for (auto& i : *mColumnIterator) { \
3133 result.push_back(t->rawIteratorAt(i)); \
3134 } \
3135 return result; \
3136 } \
3137 \
3138 template <typename T> \
3139 auto _Getter_##_first_as() const \
3140 { \
3141 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator)[0]); \
3142 } \
3143 \
3144 template <typename T> \
3145 auto _Getter_##_last_as() const \
3146 { \
3147 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator).back()); \
3148 } \
3149 \
3150 bool setCurrentRaw(o2::soa::Binding current) \
3151 { \
3152 this->mBinding = current; \
3153 return true; \
3154 } \
3155 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3156 o2::soa::Binding mBinding; \
3157 };
3158
3159#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3160#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3161
3190#define DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_, ...) \
3191 struct _Name_##Callback { \
3192 static inline constexpr auto getLambda() { return __VA_ARGS__; } \
3193 }; \
3194 \
3195 struct _Name_##Helper { \
3196 using callable_t = decltype(o2::framework::FunctionMetadata(std::declval<decltype(_Name_##Callback::getLambda())>())); \
3197 using return_type = typename callable_t::return_type; \
3198 }; \
3199 template <typename... Bindings> \
3200 struct _Name_ : o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>> { \
3201 using base = o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>>; \
3202 using helper = _Name_##Helper; \
3203 using callback_holder_t = _Name_##Callback; \
3204 using callable_t = helper::callable_t; \
3205 using callback_t = callable_t::type; \
3206 static constexpr const uint32_t hash = 0; \
3207 \
3208 _Name_(arrow::ChunkedArray const*) \
3209 { \
3210 } \
3211 _Name_() = default; \
3212 _Name_(_Name_ const& other) = default; \
3213 _Name_& operator=(_Name_ const& other) = default; \
3214 static constexpr const char* mLabel = #_Name_; \
3215 using type = typename callable_t::return_type; \
3216 \
3217 template <typename... FreeArgs> \
3218 type _Getter_(FreeArgs... freeArgs) const \
3219 { \
3220 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3221 } \
3222 template <typename... FreeArgs> \
3223 type getDynamicValue(FreeArgs... freeArgs) const \
3224 { \
3225 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3226 } \
3227 \
3228 type get() const \
3229 { \
3230 return _Getter_(); \
3231 } \
3232 \
3233 template <size_t... Is, typename... FreeArgs> \
3234 type boundGetter(std::integer_sequence<size_t, Is...>&&, FreeArgs... freeArgs) const \
3235 { \
3236 return __VA_ARGS__((**std::get<Is>(boundIterators))..., freeArgs...); \
3237 } \
3238 \
3239 using bindings_t = typename o2::framework::pack<Bindings...>; \
3240 std::tuple<o2::soa::ColumnIterator<typename Bindings::type> const*...> boundIterators; \
3241 }
3242
3243#define DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, ...) \
3244 using _Name_##Metadata = TableMetadata<Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__>;
3245
3246#define DECLARE_SOA_TABLE_METADATA_TRAIT(_Name_, _Desc_, _Version_) \
3247 template <> \
3248 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3249 using metadata = _Name_##Metadata; \
3250 };
3251
3252#define DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_) \
3253 O2HASH(_Desc_ "/" #_Version_); \
3254 template <typename O> \
3255 using _Name_##From = o2::soa::Table<Hash<_Label_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3256 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>; \
3257 template <> \
3258 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3259 using metadata = _Name_##Metadata; \
3260 };
3261
3262#define DECLARE_SOA_STAGE(_Name_, _Origin_, _Desc_, _Version_) \
3263 template <typename O> \
3264 using _Name_##From = o2::soa::Table<Hash<#_Name_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3265 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>;
3266
3267#define DECLARE_SOA_TABLE_FULL_VERSIONED(_Name_, _Label_, _Origin_, _Desc_, _Version_, ...) \
3268 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3269 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_);
3270
3271#define DECLARE_SOA_TABLE_FULL(_Name_, _Label_, _Origin_, _Desc_, ...) \
3272 O2HASH(_Label_); \
3273 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, 0, __VA_ARGS__); \
3274 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, 0)
3275
3276#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_, ...) \
3277 DECLARE_SOA_TABLE_FULL(_Name_, #_Name_, _Origin_, _Desc_, __VA_ARGS__)
3278
3279#define DECLARE_SOA_TABLE_VERSIONED(_Name_, _Origin_, _Desc_, _Version_, ...) \
3280 O2HASH(#_Name_); \
3281 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3282 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, #_Name_, _Origin_, _Desc_, _Version_)
3283
3284#define DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, _Version_, ...) \
3285 O2HASH(_Desc_ "/" #_Version_); \
3286 O2HASH(#_BaseName_); \
3287 O2HASH("Stored" #_BaseName_); \
3288 DECLARE_SOA_TABLE_METADATA(_BaseName_, _Desc_, _Version_, __VA_ARGS__); \
3289 using Stored##_BaseName_##Metadata = _BaseName_##Metadata; \
3290 DECLARE_SOA_TABLE_METADATA_TRAIT(_BaseName_, _Desc_, _Version_); \
3291 DECLARE_SOA_STAGE(_BaseName_, "AOD", _Desc_, _Version_); \
3292 DECLARE_SOA_STAGE(Stored##_BaseName_, "AOD1", _Desc_, _Version_);
3293
3294#define DECLARE_SOA_TABLE_STAGED(_BaseName_, _Desc_, ...) \
3295 DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, 0, __VA_ARGS__);
3296
3297#define DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3298 O2HASH(_Desc_ "/" #_Version_); \
3299 O2HASH(#_Name_ "Extension"); \
3300 template <typename O> \
3301 using _Name_##ExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "Extension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3302 using _Name_##Extension = _Name_##ExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3303 struct _Name_##ExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3304 using base_table_t = _OriginalTable_; \
3305 template <o2::aod::is_origin_hash O> \
3306 using extension_table_t_from = _Name_##ExtensionFrom<O>; \
3307 using extension_table_t = _Name_##Extension; \
3308 using expression_pack_t = framework::pack<__VA_ARGS__>; \
3309 static constexpr auto N = _OriginalTable_::originals.size(); \
3310 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3311 static consteval auto generateSources() \
3312 { \
3313 return _OriginalTable_##From<O>::originals; \
3314 } \
3315 }; \
3316 template <> \
3317 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3318 using metadata = _Name_##ExtensionMetadata; \
3319 }; \
3320 template <typename O> \
3321 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##ExtensionFrom<O>>; \
3322 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3323
3324#define DECLARE_SOA_EXTENDED_TABLE(_Name_, _Table_, _Description_, _Version_, ...) \
3325 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, _Description_, _Version_, __VA_ARGS__)
3326
3327#define DECLARE_SOA_EXTENDED_TABLE_USER(_Name_, _Table_, _Description_, ...) \
3328 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, "EX" _Description_, 0, __VA_ARGS__)
3329
3330#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3331 O2HASH(_Desc_ "/" #_Version_); \
3332 O2HASH(#_Name_ "CfgExtension"); \
3333 template <typename O> \
3334 using _Name_##CfgExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "CfgExtension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3335 using _Name_##CfgExtension = _Name_##CfgExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3336 struct _Name_##CfgExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3337 using base_table_t = _OriginalTable_; \
3338 template <o2::aod::is_origin_hash O> \
3339 using extension_table_t_from = _Name_##CfgExtensionFrom<O>; \
3340 using extension_table_t = _Name_##CfgExtension; \
3341 using placeholders_pack_t = framework::pack<__VA_ARGS__>; \
3342 using configurable_t = std::true_type; \
3343 static constexpr auto N = _OriginalTable_::originals.size(); \
3344 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3345 static consteval auto generateSources() \
3346 { \
3347 return _OriginalTable_##From<O>::originals; \
3348 } \
3349 }; \
3350 template <> \
3351 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3352 using metadata = _Name_##CfgExtensionMetadata; \
3353 }; \
3354 template <typename O> \
3355 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##CfgExtensionFrom<O>>; \
3356 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3357
3358#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE(_Name_, _OriginalTable_, _Description_, ...) \
3359 DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, "EX" _Description_, 0, __VA_ARGS__)
3360
3361#define DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, _Version_, _Desc_, _Exclusive_, ...) \
3362 O2HASH(#_Name_); \
3363 O2HASH(_Desc_ "/" #_Version_); \
3364 struct _Name_##Metadata : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3365 static constexpr bool exclusive = _Exclusive_; \
3366 template <o2::aod::is_origin_hash O> \
3367 using KeyFrom = _Key_##From<O>; \
3368 using Key = _Key_; \
3369 using index_pack_t = framework::pack<__VA_ARGS__>; \
3370 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3371 static consteval auto generateSources() \
3372 { \
3373 return []<soa::is_index_column... Cs>(framework::pack<Cs...>) { \
3374 constexpr auto first = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3375 constexpr auto second = o2::aod::filterForKey<first.size(), first, Key>(); \
3376 return o2::aod::replaceOrigin<second.size(), second, O>(); \
3377 }(framework::pack<__VA_ARGS__>{}); \
3378 } \
3379 static constexpr auto N = []<typename... Cs>(framework::pack<Cs...>) { \
3380 constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3381 return o2::aod::filterForKey<a.size(), a, Key>(); \
3382 }(framework::pack<__VA_ARGS__>{}) \
3383 .size(); \
3384 }; \
3385 template <> \
3386 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3387 using metadata = _Name_##Metadata; \
3388 }; \
3389 template <o2::aod::is_origin_hash O> \
3390 using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_##From<O>, __VA_ARGS__>; \
3391 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3392
3393#define DECLARE_SOA_INDEX_TABLE(_Name_, _Key_, _Description_, ...) \
3394 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3395
3396#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE(_Name_, _Key_, _Description_, ...) \
3397 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3398
3399#define DECLARE_SOA_INDEX_TABLE_USER(_Name_, _Key_, _Description_, ...) \
3400 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3401
3402#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE_USER(_Name_, _Key_, _Description_, ...) \
3403 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3404
3405// Declare were each row is associated to a timestamp column of an _TimestampSource_
3406// table.
3407//
3408// The columns of this table have to be CCDB_COLUMNS so that for each timestamp, we get a row
3409// which points to the specified CCDB objectes described by those columns.
3410#define DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, _Label_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, ...) \
3411 O2HASH(_Desc_ "/" #_Version_); \
3412 template <typename O> \
3413 using _Name_##TimestampFrom = soa::Table<o2::aod::Hash<_Label_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3414 using _Name_##Timestamp = _Name_##TimestampFrom<o2::aod::Hash< \
3415 "AOD" \
3416 ""_h>>; \
3417 struct _Name_##TimestampMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3418 template <typename O = o2::aod::Hash<"AOD" \
3419 ""_h>> \
3420 using base_table_t = _TimestampSource_##From<O>; \
3421 template <typename O = o2::aod::Hash<"AOD" \
3422 ""_h>> \
3423 using extension_table_t = _Name_##TimestampFrom<O>; \
3424 static constexpr const auto ccdb_urls = []<typename... Cs>(framework::pack<Cs...>) { \
3425 return std::array<std::string_view, sizeof...(Cs)>{Cs::query...}; \
3426 }(framework::pack<__VA_ARGS__>{}); \
3427 static constexpr const auto ccdb_bindings = []<typename... Cs>(framework::pack<Cs...>) { \
3428 return std::array<std::string_view, sizeof...(Cs)>{Cs::mLabel...}; \
3429 }(framework::pack<__VA_ARGS__>{}); \
3430 static constexpr auto N = _TimestampSource_::originals.size(); \
3431 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3432 static consteval auto generateSources() \
3433 { \
3434 return _TimestampSource_##From<O>::originals; \
3435 } \
3436 static constexpr auto timestamp_column_label = _TimestampColumn_::mLabel; \
3437 /*static constexpr auto timestampColumn = _TimestampColumn_;*/ \
3438 }; \
3439 template <> \
3440 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3441 using metadata = _Name_##TimestampMetadata; \
3442 }; \
3443 template <typename O> \
3444 using _Name_##From = o2::soa::Join<_TimestampSource_, _Name_##TimestampFrom<O>>; \
3445 using _Name_ = _Name_##From<o2::aod::Hash< \
3446 "AOD" \
3447 ""_h>>;
3448
3449#define DECLARE_SOA_TIMESTAMPED_TABLE(_Name_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, ...) \
3450 O2HASH(#_Name_ "Timestamped"); \
3451 DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, #_Name_ "Timestamped", _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, __VA_ARGS__)
3452
3453namespace o2::soa
3454{
3455template <typename... Ts>
3456struct Join : Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Ts...> {
3457 using base = Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Ts...>;
3458
3459 Join(std::shared_ptr<arrow::Table>&& table, uint64_t offset = 0)
3460 : base{std::move(table), offset}
3461 {
3462 if (this->tableSize() != 0) {
3464 }
3465 }
3466 Join(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
3467 : base{ArrowHelpers::joinTables(std::move(tables), std::span{base::originalLabels}), offset}
3468 {
3469 if (this->tableSize() != 0) {
3471 }
3472 }
3475 static constexpr const uint32_t binding_origin = base::binding_origin;
3477
3478 template <typename... TA>
3479 void bindExternalIndices(TA*... current)
3480 {
3481 ([this](TA* cur) {
3482 if constexpr (binding_origin == TA::binding_origin) {
3483 this->bindExternalIndex(cur);
3484 }
3485 }(current),
3486 ...);
3487 }
3488
3489 using self_t = Join<Ts...>;
3490 using table_t = base;
3491 static constexpr const auto originals = base::originals;
3492 static constexpr const auto originalLabels = base::originalLabels;
3495 using iterator = table_t::template iterator_template<DefaultIndexPolicy, self_t, Ts...>;
3501
3503 {
3504 return iterator{this->cached_begin()};
3505 }
3506
3508 {
3509 return const_iterator{this->cached_begin()};
3510 }
3511
3513 {
3514 return doSliceByCached(this, node, value, cache);
3515 }
3516
3521
3522 template <typename T1, typename Policy, bool OPT>
3524 {
3525 return doSliceBy(this, container, value);
3526 }
3527
3528 iterator rawIteratorAt(uint64_t i) const
3529 {
3530 auto it = iterator{this->cached_begin()};
3531 it.setCursor(i);
3532 return it;
3533 }
3534
3535 iterator iteratorAt(uint64_t i) const
3536 {
3537 return rawIteratorAt(i);
3538 }
3539
3540 auto rawSlice(uint64_t start, uint64_t end) const
3541 {
3542 return self_t{{this->asArrowTable()->Slice(start, end - start + 1)}, start};
3543 }
3544
3545 auto emptySlice() const
3546 {
3547 return self_t{{this->asArrowTable()->Slice(0, 0)}, 0};
3548 }
3549
3550 template <typename T>
3551 static consteval bool contains()
3552 {
3553 return []<size_t... Is>(std::index_sequence<Is...>) {
3554 return (std::ranges::any_of(originals, [](TableRef const& ref) { return ref.desc_hash == T::originals[Is].desc_hash; }) && ...);
3555 }(std::make_index_sequence<T::originals.size()>());
3556 }
3557};
3558
3559template <typename... Ts>
3560constexpr auto join(Ts const&... t)
3561{
3562 return Join<Ts...>(ArrowHelpers::joinTables({t.asArrowTable()...}, std::span{Join<Ts...>::base::originalLabels}));
3563}
3564
3565template <typename T>
3567
3568template <typename T>
3569constexpr bool is_soa_join_v = is_join<T>;
3570
3571template <typename... Ts>
3572struct Concat : Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...> {
3573 using base = Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...>;
3574 using self_t = Concat<Ts...>;
3575 Concat(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t offset = 0)
3576 : base{ArrowHelpers::concatTables(std::move(tables)), offset}
3577 {
3579 }
3580 Concat(Ts const&... t, uint64_t offset = 0)
3581 : base{ArrowHelpers::concatTables({t.asArrowTable()...}), offset}
3582 {
3583 bindInternalIndicesTo(this);
3584 }
3585
3586 using base::originals;
3587
3588 using base::bindExternalIndices;
3589 using base::bindInternalIndicesTo;
3590
3591 using table_t = base;
3594
3595 using iterator = table_t::template iterator_template<DefaultIndexPolicy, self_t, Ts...>;
3601};
3602
3603template <typename... Ts>
3604constexpr auto concat(Ts const&... t)
3605{
3606 return Concat<Ts...>{t...};
3607}
3608
3609template <soa::is_table T>
3610class FilteredBase : public T
3611{
3612 public:
3614 using table_t = typename T::table_t;
3615 using T::originals;
3616 static constexpr const uint32_t binding_origin = T::binding_origin;
3617 static constexpr const header::DataOrigin binding_origin_ = T::binding_origin_;
3618 template <typename... TA>
3619 void bindExternalIndices(TA*... current)
3620 {
3621 ([this](TA* cur) {
3622 if constexpr (binding_origin == TA::binding_origin) {
3623 this->bindExternalIndex(cur);
3624 mFilteredBegin.bindExternalIndex(cur);
3625 }
3626 }(current),
3627 ...);
3628 }
3629 using columns_t = typename T::columns_t;
3630 using persistent_columns_t = typename T::persistent_columns_t;
3631 using external_index_columns_t = typename T::external_index_columns_t;
3632
3633 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3634 using unfiltered_iterator = T::template iterator_template_o<DefaultIndexPolicy, self_t>;
3636
3637 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
3638 : T{std::move(tables), offset},
3639 mSelectedRows{getSpan(selection)}
3640 {
3641 if (this->tableSize() != 0) {
3642 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3643 }
3644 resetRanges();
3645 mFilteredBegin.bindInternalIndices(this);
3646 }
3647
3648 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
3649 : T{std::move(tables), offset},
3650 mSelectedRowsCache{std::move(selection)},
3651 mCached{true}
3652 {
3653 mSelectedRows = std::span{mSelectedRowsCache};
3654 if (this->tableSize() != 0) {
3655 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3656 }
3657 resetRanges();
3658 mFilteredBegin.bindInternalIndices(this);
3659 }
3660
3661 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
3662 : T{std::move(tables), offset},
3663 mSelectedRows{selection}
3664 {
3665 if (this->tableSize() != 0) {
3666 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3667 }
3668 resetRanges();
3669 mFilteredBegin.bindInternalIndices(this);
3670 }
3671
3673 {
3674 return iterator(mFilteredBegin);
3675 }
3676
3678 {
3679 return const_iterator(mFilteredBegin);
3680 }
3681
3683 {
3684 auto it = unfiltered_iterator{mFilteredBegin};
3685 it.setCursor(i);
3686 return it;
3687 }
3688
3689 [[nodiscard]] RowViewSentinel end() const
3690 {
3691 return RowViewSentinel{*mFilteredEnd};
3692 }
3693
3695 {
3696 return mFilteredBegin;
3697 }
3698
3699 auto const& cached_begin() const
3700 {
3701 return mFilteredBegin;
3702 }
3703
3704 iterator iteratorAt(uint64_t i) const
3705 {
3706 return mFilteredBegin + i;
3707 }
3708
3709 [[nodiscard]] int64_t size() const
3710 {
3711 return mSelectedRows.size();
3712 }
3713
3714 [[nodiscard]] int64_t tableSize() const
3715 {
3716 return table_t::asArrowTable()->num_rows();
3717 }
3718
3719 auto const& getSelectedRows() const
3720 {
3721 return mSelectedRows;
3722 }
3723
3724 auto rawSlice(uint64_t start, uint64_t end) const
3725 {
3726 SelectionVector newSelection;
3727 newSelection.resize(static_cast<int64_t>(end - start + 1));
3728 std::iota(newSelection.begin(), newSelection.end(), start);
3729 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3730 }
3731
3732 auto emptySlice() const
3733 {
3734 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
3735 }
3736
3737 static inline auto getSpan(gandiva::Selection const& sel)
3738 {
3739 if (sel == nullptr) {
3740 return std::span<int64_t const>{};
3741 }
3742 auto array = std::static_pointer_cast<arrow::Int64Array>(sel->ToArray());
3743 auto start = array->raw_values();
3744 auto stop = start + array->length();
3745 return std::span{start, stop};
3746 }
3747
3750 void bindExternalIndicesRaw(std::vector<o2::soa::Binding>&& ptrs)
3751 {
3752 mFilteredBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
3753 }
3754
3755 template <typename I>
3757 {
3758 mFilteredBegin.bindInternalIndices(ptr);
3759 }
3760
3761 template <typename T1, typename... Cs>
3763 {
3764 dest.bindExternalIndicesRaw(mFilteredBegin.getIndexBindings());
3765 }
3766
3767 template <typename T1>
3768 void copyIndexBindings(T1& dest) const
3769 {
3770 doCopyIndexBindings(external_index_columns_t{}, dest);
3771 }
3772
3773 template <typename T1>
3774 auto rawSliceBy(o2::framework::Preslice<T1> const& container, int value) const
3775 {
3776 return (table_t)this->sliceBy(container, value);
3777 }
3778
3780 {
3781 return doFilteredSliceByCached(this, node, value, cache);
3782 }
3783
3788
3789 template <typename T1, bool OPT>
3791 {
3792 return doFilteredSliceBy(this, container, value);
3793 }
3794
3795 template <typename T1, bool OPT>
3797 {
3798 return doSliceBy(this, container, value);
3799 }
3800
3802 {
3803 auto t = o2::soa::select(*this, f);
3804 copyIndexBindings(t);
3805 return t;
3806 }
3807
3808 int isInSelectedRows(int i) const
3809 {
3810 auto locate = std::find(mSelectedRows.begin(), mSelectedRows.end(), i);
3811 if (locate == mSelectedRows.end()) {
3812 return -1;
3813 }
3814 return static_cast<int>(std::distance(mSelectedRows.begin(), locate));
3815 }
3816
3817 void sumWithSelection(SelectionVector const& selection)
3818 {
3819 mCached = true;
3820 SelectionVector rowsUnion;
3821 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3822 mSelectedRowsCache.clear();
3823 mSelectedRowsCache = rowsUnion;
3824 resetRanges();
3825 }
3826
3828 {
3829 mCached = true;
3830 SelectionVector intersection;
3831 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3832 mSelectedRowsCache.clear();
3833 mSelectedRowsCache = intersection;
3834 resetRanges();
3835 }
3836
3837 void sumWithSelection(std::span<int64_t const> const& selection)
3838 {
3839 mCached = true;
3840 SelectionVector rowsUnion;
3841 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3842 mSelectedRowsCache.clear();
3843 mSelectedRowsCache = rowsUnion;
3844 resetRanges();
3845 }
3846
3847 void intersectWithSelection(std::span<int64_t const> const& selection)
3848 {
3849 mCached = true;
3850 SelectionVector intersection;
3851 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3852 mSelectedRowsCache.clear();
3853 mSelectedRowsCache = intersection;
3854 resetRanges();
3855 }
3856
3857 bool isCached() const
3858 {
3859 return mCached;
3860 }
3861
3862 private:
3863 void resetRanges()
3864 {
3865 if (mCached) {
3866 mSelectedRows = std::span{mSelectedRowsCache};
3867 }
3868 mFilteredEnd.reset(new RowViewSentinel{static_cast<int64_t>(mSelectedRows.size())});
3869 if (tableSize() == 0) {
3870 mFilteredBegin = *mFilteredEnd;
3871 } else {
3872 mFilteredBegin.resetSelection(mSelectedRows);
3873 }
3874 }
3875
3876 std::span<int64_t const> mSelectedRows;
3877 SelectionVector mSelectedRowsCache;
3878 bool mCached = false;
3879 iterator mFilteredBegin;
3880 std::shared_ptr<RowViewSentinel> mFilteredEnd;
3881};
3882
3883template <typename T>
3884class Filtered : public FilteredBase<T>
3885{
3886 public:
3887 using base_t = T;
3889 using table_t = typename T::table_t;
3890 using columns_t = typename T::columns_t;
3891
3892 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3893 using unfiltered_iterator = T::template iterator_template_o<DefaultIndexPolicy, self_t>;
3895
3897 {
3898 return iterator(this->cached_begin());
3899 }
3900
3902 {
3903 return const_iterator(this->cached_begin());
3904 }
3905
3906 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
3907 : FilteredBase<T>(std::move(tables), selection, offset) {}
3908
3909 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
3910 : FilteredBase<T>(std::move(tables), std::forward<SelectionVector>(selection), offset) {}
3911
3912 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
3913 : FilteredBase<T>(std::move(tables), selection, offset) {}
3914
3916 {
3917 Filtered<T> copy(*this);
3918 copy.sumWithSelection(selection);
3919 return copy;
3920 }
3921
3922 Filtered<T> operator+(std::span<int64_t const> const& selection)
3923 {
3924 Filtered<T> copy(*this);
3925 copy.sumWithSelection(selection);
3926 return copy;
3927 }
3928
3930 {
3931 return operator+(other.getSelectedRows());
3932 }
3933
3935 {
3936 this->sumWithSelection(selection);
3937 return *this;
3938 }
3939
3940 Filtered<T> operator+=(std::span<int64_t const> const& selection)
3941 {
3942 this->sumWithSelection(selection);
3943 return *this;
3944 }
3945
3947 {
3948 return operator+=(other.getSelectedRows());
3949 }
3950
3952 {
3953 Filtered<T> copy(*this);
3954 copy.intersectWithSelection(selection);
3955 return copy;
3956 }
3957
3958 Filtered<T> operator*(std::span<int64_t const> const& selection)
3959 {
3960 Filtered<T> copy(*this);
3961 copy.intersectWithSelection(selection);
3962 return copy;
3963 }
3964
3966 {
3967 return operator*(other.getSelectedRows());
3968 }
3969
3971 {
3972 this->intersectWithSelection(selection);
3973 return *this;
3974 }
3975
3976 Filtered<T> operator*=(std::span<int64_t const> const& selection)
3977 {
3978 this->intersectWithSelection(selection);
3979 return *this;
3980 }
3981
3983 {
3984 return operator*=(other.getSelectedRows());
3985 }
3986
3988 {
3989 auto it = unfiltered_iterator{this->cached_begin()};
3990 it.setCursor(i);
3991 return it;
3992 }
3993
3994 using FilteredBase<T>::getSelectedRows;
3995
3996 auto rawSlice(uint64_t start, uint64_t end) const
3997 {
3998 SelectionVector newSelection;
3999 newSelection.resize(static_cast<int64_t>(end - start + 1));
4000 std::iota(newSelection.begin(), newSelection.end(), start);
4001 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
4002 }
4003
4004 auto emptySlice() const
4005 {
4006 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
4007 }
4008
4009 template <typename T1>
4010 auto rawSliceBy(o2::framework::Preslice<T1> const& container, int value) const
4011 {
4012 return (table_t)this->sliceBy(container, value);
4013 }
4014
4016 {
4017 return doFilteredSliceByCached(this, node, value, cache);
4018 }
4019
4024
4025 template <typename T1, bool OPT>
4027 {
4028 return doFilteredSliceBy(this, container, value);
4029 }
4030
4031 template <typename T1, bool OPT>
4033 {
4034 return doSliceBy(this, container, value);
4035 }
4036
4038 {
4039 auto t = o2::soa::select(*this, f);
4040 copyIndexBindings(t);
4041 return t;
4042 }
4043};
4044
4045template <typename T>
4046class Filtered<Filtered<T>> : public FilteredBase<typename T::table_t>
4047{
4048 public:
4050 using base_t = T;
4052 using columns_t = typename T::columns_t;
4053
4054 using iterator = typename T::template iterator_template_o<FilteredIndexPolicy, self_t>;
4055 using unfiltered_iterator = typename T::template iterator_template_o<DefaultIndexPolicy, self_t>;
4057
4059 {
4060 return iterator(this->cached_begin());
4061 }
4062
4064 {
4065 return const_iterator(this->cached_begin());
4066 }
4067
4068 Filtered(std::vector<Filtered<T>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
4069 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), selection, offset)
4070 {
4071 for (auto& table : tables) {
4072 *this *= table;
4073 }
4074 }
4075
4076 Filtered(std::vector<Filtered<T>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
4077 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), std::forward<SelectionVector>(selection), offset)
4078 {
4079 for (auto& table : tables) {
4080 *this *= table;
4081 }
4082 }
4083
4084 Filtered(std::vector<Filtered<T>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
4085 : FilteredBase<typename T::table_t>(std::move(extractTablesFromFiltered(tables)), selection, offset)
4086 {
4087 for (auto& table : tables) {
4088 *this *= table;
4089 }
4090 }
4091
4093 {
4094 Filtered<Filtered<T>> copy(*this);
4095 copy.sumWithSelection(selection);
4096 return copy;
4097 }
4098
4099 Filtered<Filtered<T>> operator+(std::span<int64_t const> const& selection)
4100 {
4101 Filtered<Filtered<T>> copy(*this);
4102 copy.sumWithSelection(selection);
4103 return copy;
4104 }
4105
4107 {
4108 return operator+(other.getSelectedRows());
4109 }
4110
4112 {
4113 this->sumWithSelection(selection);
4114 return *this;
4115 }
4116
4117 Filtered<Filtered<T>> operator+=(std::span<int64_t const> const& selection)
4118 {
4119 this->sumWithSelection(selection);
4120 return *this;
4121 }
4122
4124 {
4125 return operator+=(other.getSelectedRows());
4126 }
4127
4129 {
4130 Filtered<Filtered<T>> copy(*this);
4131 copy.intersectionWithSelection(selection);
4132 return copy;
4133 }
4134
4135 Filtered<Filtered<T>> operator*(std::span<int64_t const> const& selection)
4136 {
4137 Filtered<Filtered<T>> copy(*this);
4138 copy.intersectionWithSelection(selection);
4139 return copy;
4140 }
4141
4143 {
4144 return operator*(other.getSelectedRows());
4145 }
4146
4148 {
4149 this->intersectWithSelection(selection);
4150 return *this;
4151 }
4152
4153 Filtered<Filtered<T>> operator*=(std::span<int64_t const> const& selection)
4154 {
4155 this->intersectWithSelection(selection);
4156 return *this;
4157 }
4158
4160 {
4161 return operator*=(other.getSelectedRows());
4162 }
4163
4165 {
4166 auto it = unfiltered_iterator{this->cached_begin()};
4167 it.setCursor(i);
4168 return it;
4169 }
4170
4171 auto rawSlice(uint64_t start, uint64_t end) const
4172 {
4173 SelectionVector newSelection;
4174 newSelection.resize(static_cast<int64_t>(end - start + 1));
4175 std::iota(newSelection.begin(), newSelection.end(), start);
4176 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
4177 }
4178
4179 auto emptySlice() const
4180 {
4181 return self_t{{this->asArrowTable()}, SelectionVector{}, 0};
4182 }
4183
4185 {
4186 return doFilteredSliceByCached(this, node, value, cache);
4187 }
4188
4193
4194 template <typename T1, bool OPT>
4196 {
4197 return doFilteredSliceBy(this, container, value);
4198 }
4199
4200 template <typename T1, bool OPT>
4202 {
4203 return doSliceBy(this, container, value);
4204 }
4205
4206 private:
4207 std::vector<std::shared_ptr<arrow::Table>> extractTablesFromFiltered(std::vector<Filtered<T>>& tables)
4208 {
4209 std::vector<std::shared_ptr<arrow::Table>> outTables;
4210 for (auto& table : tables) {
4211 outTables.push_back(table.asArrowTable());
4212 }
4213 return outTables;
4214 }
4215};
4216
4222template <typename L, typename D, typename O, typename Key, typename H, typename... Ts>
4223struct IndexTable : Table<L, D, O> {
4224 using self_t = IndexTable<L, D, O, Key, H, Ts...>;
4229 using first_t = typename H::binding_t;
4230 using rest_t = framework::pack<typename Ts::binding_t...>;
4231
4232 static constexpr const uint32_t binding_origin = Key::binding_origin;
4233 static constexpr const header::DataOrigin binding_origin_ = Key::binding_origin_;
4234
4235 template <typename... TA>
4236 void bindExternalIndices(TA*... current)
4237 {
4238 ([this](TA* cur) {
4239 if constexpr (binding_origin == TA::binding_origin) {
4240 this->bindExternalIndex(cur);
4241 }
4242 }(current),
4243 ...);
4244 }
4245
4246 IndexTable(std::shared_ptr<arrow::Table> table, uint64_t offset = 0)
4247 : base_t{table, offset}
4248 {
4249 }
4250
4251 IndexTable(std::vector<std::shared_ptr<arrow::Table>> tables, uint64_t offset = 0)
4252 : base_t{tables[0], offset}
4253 {
4254 }
4255
4256 IndexTable(IndexTable const&) = default;
4258 IndexTable& operator=(IndexTable const&) = default;
4260
4265};
4266
4267template <typename T, bool APPLY>
4268struct SmallGroupsBase : public Filtered<T> {
4269 static constexpr bool applyFilters = APPLY;
4270 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gandiva::Selection const& selection, uint64_t offset = 0)
4271 : Filtered<T>(std::move(tables), selection, offset) {}
4272
4273 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, SelectionVector&& selection, uint64_t offset = 0)
4274 : Filtered<T>(std::move(tables), std::forward<SelectionVector>(selection), offset) {}
4275
4276 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::span<int64_t const> const& selection, uint64_t offset = 0)
4277 : Filtered<T>(std::move(tables), selection, offset) {}
4278};
4279
4280template <typename T>
4282
4283template <typename T>
4285
4286template <typename T>
4287concept is_smallgroups = requires {
4288 []<typename B, bool A>(SmallGroupsBase<B, A>*) {}(std::declval<T*>());
4289};
4290} // namespace o2::soa
4291
4292#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:2653
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:3857
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3784
int64_t tableSize() const
Definition ASoA.h:3714
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:3637
auto & cached_begin()
Definition ASoA.h:3694
typename T::external_index_columns_t external_index_columns_t
Definition ASoA.h:3631
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:3801
static auto getSpan(gandiva::Selection const &sel)
Definition ASoA.h:3737
int64_t size() const
Definition ASoA.h:3709
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:3633
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
Definition ASoA.h:3774
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:3634
void copyIndexBindings(T1 &dest) const
Definition ASoA.h:3768
auto const & getSelectedRows() const
Definition ASoA.h:3719
void sumWithSelection(std::span< int64_t const > const &selection)
Definition ASoA.h:3837
void intersectWithSelection(std::span< int64_t const > const &selection)
Definition ASoA.h:3847
typename T::columns_t columns_t
Definition ASoA.h:3629
auto emptySlice() const
Definition ASoA.h:3732
void bindExternalIndices(TA *... current)
Definition ASoA.h:3619
void sumWithSelection(SelectionVector const &selection)
Definition ASoA.h:3817
void bindInternalIndicesTo(I const *ptr)
Definition ASoA.h:3756
void intersectWithSelection(SelectionVector const &selection)
Definition ASoA.h:3827
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:3796
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:3661
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3724
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:3790
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:3704
iterator const_iterator
Definition ASoA.h:3635
typename T::table_t table_t
Definition ASoA.h:3614
typename T::persistent_columns_t persistent_columns_t
Definition ASoA.h:3630
RowViewSentinel end() const
Definition ASoA.h:3689
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:3648
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:3750
const_iterator begin() const
Definition ASoA.h:3677
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3682
int isInSelectedRows(int i) const
Definition ASoA.h:3808
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3779
void doCopyIndexBindings(framework::pack< Cs... >, T1 &dest) const
Definition ASoA.h:3762
iterator begin()
Definition ASoA.h:3672
auto const & cached_begin() const
Definition ASoA.h:3699
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:4195
Filtered< Filtered< T > > operator*(std::span< int64_t const > const &selection)
Definition ASoA.h:4135
typename FilteredBase< typename T::table_t >::table_t table_t
Definition ASoA.h:4051
typename T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:4055
Filtered< Filtered< T > > operator+(SelectionVector const &selection)
Definition ASoA.h:4092
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:4201
Filtered< Filtered< T > > operator+=(std::span< int64_t const > const &selection)
Definition ASoA.h:4117
typename T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:4054
typename T::columns_t columns_t
Definition ASoA.h:4052
const_iterator begin() const
Definition ASoA.h:4063
Filtered(std::vector< Filtered< T > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:4084
Filtered< Filtered< T > > operator+(std::span< int64_t const > const &selection)
Definition ASoA.h:4099
Filtered(std::vector< Filtered< T > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:4076
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:4164
Filtered< Filtered< T > > operator*=(std::span< int64_t const > const &selection)
Definition ASoA.h:4153
Filtered< Filtered< T > > operator+=(Filtered< T > const &other)
Definition ASoA.h:4123
Filtered< Filtered< T > > operator+=(SelectionVector const &selection)
Definition ASoA.h:4111
Filtered< Filtered< T > > operator*=(SelectionVector const &selection)
Definition ASoA.h:4147
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:4171
Filtered< Filtered< T > > operator+(Filtered< T > const &other)
Definition ASoA.h:4106
Filtered(std::vector< Filtered< T > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:4068
Filtered< Filtered< T > > operator*=(Filtered< T > const &other)
Definition ASoA.h:4159
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4184
Filtered< Filtered< T > > operator*(Filtered< T > const &other)
Definition ASoA.h:4142
Filtered< Filtered< T > > operator*(SelectionVector const &selection)
Definition ASoA.h:4128
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4189
Filtered< T > operator*(std::span< int64_t const > const &selection)
Definition ASoA.h:3958
Filtered< T > operator+=(Filtered< T > const &other)
Definition ASoA.h:3946
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Definition ASoA.h:4032
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Definition ASoA.h:3909
iterator const_iterator
Definition ASoA.h:3894
Filtered< T > operator+(std::span< int64_t const > const &selection)
Definition ASoA.h:3922
iterator begin()
Definition ASoA.h:3896
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4020
Filtered< T > operator+(Filtered< T > const &other)
Definition ASoA.h:3929
Filtered< T > operator*=(SelectionVector const &selection)
Definition ASoA.h:3970
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:3912
auto emptySlice() const
Definition ASoA.h:4004
const_iterator begin() const
Definition ASoA.h:3901
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
Definition ASoA.h:3892
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:4015
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:4037
Filtered< T > operator+(SelectionVector const &selection)
Definition ASoA.h:3915
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Definition ASoA.h:3893
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3987
Filtered< T > operator*(SelectionVector const &selection)
Definition ASoA.h:3951
Filtered< T > operator*=(Filtered< T > const &other)
Definition ASoA.h:3982
Filtered< T > operator*(Filtered< T > const &other)
Definition ASoA.h:3965
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
Definition ASoA.h:4010
Filtered< T > operator+=(SelectionVector const &selection)
Definition ASoA.h:3934
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3996
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:3906
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Definition ASoA.h:4026
Filtered< T > operator*=(std::span< int64_t const > const &selection)
Definition ASoA.h:3976
Filtered< T > operator+=(std::span< int64_t const > const &selection)
Definition ASoA.h:3940
typename T::table_t table_t
Definition ASoA.h:3889
typename T::columns_t columns_t
Definition ASoA.h:3890
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_self_index_t, C... > {}(columns_t{})) internal_index_columns_t
Definition ASoA.h:1899
void bindInternalIndicesExplicit(o2::soa::Binding binding)
Definition ASoA.h:2237
auto & cached_begin()
Definition ASoA.h:2140
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:2169
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_persistent_column_t, C... > {}(columns_t{})) persistent_columns_t
Definition ASoA.h:1895
static constexpr const auto ref
Definition ASoA.h:1852
auto offset() const
Return offset.
Definition ASoA.h:2197
static consteval bool hasOriginal()
Definition ASoA.h:1888
unfiltered_iterator begin()
Definition ASoA.h:2150
int64_t tableSize() const
Definition ASoA.h:2207
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:2288
void bindExternalIndices(TA *... current)
Definition ASoA.h:2215
auto select(framework::expressions::Filter const &f) const
Definition ASoA.h:2265
unfiltered_iterator unfiltered_const_iterator
Definition ASoA.h:2081
static consteval auto full_iter()
Definition ASoA.h:2060
auto const & cached_begin() const
Definition ASoA.h:2145
auto emptySlice() const
Definition ASoA.h:2293
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:2277
static constexpr header::DataOrigin binding_origin_
Definition ASoA.h:1861
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
Definition ASoA.h:2248
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
Definition ASoA.h:2283
static constexpr auto hashes()
Definition ASoA.h:2083
iterator unfiltered_iterator
Definition ASoA.h:2079
void bindExternalIndex(TA *current)
Definition ASoA.h:2226
std::shared_ptr< arrow::Table > asArrowTable() const
Return a type erased arrow table backing store for / the type safe table.
Definition ASoA.h:2192
filtered_iterator filtered_begin(std::span< int64_t const > selection)
Definition ASoA.h:2160
void doCopyIndexBindings(framework::pack< Cs... >, T &dest) const
Definition ASoA.h:2254
int64_t size() const
Size of the table, in rows.
Definition ASoA.h:2202
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:2114
decltype(getColumns< ref, Ts... >()) columns_t
Definition ASoA.h:1893
arrow::ChunkedArray * getIndexToKey()
Definition ASoA.h:2121
RowViewSentinel end()
Definition ASoA.h:2155
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::type... > {}(persistent_columns_t{})) column_types
Definition ASoA.h:1896
static constexpr const uint32_t binding_origin
Definition ASoA.h:1860
static consteval auto isIndexTargetOf()
Definition ASoA.h:1865
iterator_template_o< FilteredIndexPolicy, table_t > filtered_iterator
Definition ASoA.h:2077
unfiltered_const_iterator begin() const
Definition ASoA.h:2181
void copyIndexBindings(T &dest) const
Definition ASoA.h:2260
static constexpr const auto originalLabels
Definition ASoA.h:1857
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:2108
Table< L, D, O, Ts... > self_t
Definition ASoA.h:1853
static consteval auto isIndexTargetOf()
Definition ASoA.h:1872
decltype(full_iter< IP, Parent >()) iterator_template_o
Definition ASoA.h:2074
void doBindInternalIndicesExplicit(framework::pack< Cs... >, o2::soa::Binding binding)
Definition ASoA.h:2243
static constexpr const auto originals
Definition ASoA.h:1856
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_external_index_t, C... > {}(columns_t{})) external_index_columns_t
Definition ASoA.h:1898
Table(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
Definition ASoA.h:2088
RowViewSentinel end() const
Definition ASoA.h:2186
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:2272
void bindInternalIndicesTo(I const *ptr)
Definition ASoA.h:2232
unfiltered_iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:2174
iterator_template_o< DefaultIndexPolicy, table_t > iterator
Definition ASoA.h:2076
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:275
typename pack_element< 0, T >::type pack_head_t
Definition Pack.h:59
std::string cutString(std::string &&str)
Definition ASoA.cxx:266
std::vector< std::vector< int64_t > > ListVector
Descriptor< gSizeDataDescriptionString > DataDescription
Definition DataHeader.h:551
R getColumnValue(const T &rowIterator)
Definition ASoA.h:2326
ColumnGetterFunction< R, typename T::iterator > getColumnGetterByLabel(const std::string_view &targetColumnLabel)
Definition ASoA.h:2393
void * extractCCDBPayload(char *payload, size_t size, TClass const *cl, const char *what)
Definition ASoA.cxx:206
consteval auto computeOriginals()
Definition ASoA.h:1828
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:3560
auto doSliceBy(T const *table, o2::framework::PresliceBase< C, Policy, OPT > const &container, int value)
Definition ASoA.h:1656
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:1732
constexpr auto concat(Ts const &... t)
Definition ASoA.h:3604
consteval auto intersectOriginals()
Definition ASoA.h:171
consteval auto getColumns()
Definition ASoA.h:1800
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:1637
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:1766
auto doSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
Definition ASoA.h:1745
void accessingInvalidIndexFor(const char *getter)
Definition ASoA.cxx:25
auto select(T const &t, framework::expressions::Filter const &f)
Definition ASoA.h:1786
consteval auto base_iter(framework::pack< C... > &&) -> TableIterator< D, O, IP, C... >
Definition ASoA.h:1794
constexpr bool is_index_equivalent_v
Definition ASoA.h:477
constexpr bool is_soa_join_v
Definition ASoA.h:3569
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:1713
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:1757
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:1674
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:1562
static constexpr bool optional
Definition ASoA.h:1552
PresliceBase(expressions::BindingNode index_)
Definition ASoA.h:1557
std::span< const int64_t > getSliceFor(int value) const
Definition ASoA.h:1572
const std::string binding
Definition ASoA.h:1555
const std::string binding
Definition ASoA.h:1526
Entry const & getBindingKey() const
Definition ASoA.cxx:286
SliceInfoUnsortedPtr sliceInfo
Definition ASoA.h:1543
std::span< const int64_t > getSliceFor(int value) const
Definition ASoA.cxx:309
void updateSliceInfo(SliceInfoUnsortedPtr &&si)
Definition ASoA.cxx:296
void updateSliceInfo(SliceInfoPtr &&si)
Definition ASoA.cxx:291
std::shared_ptr< arrow::Table > getSliceFor(int value, std::shared_ptr< arrow::Table > const &input, uint64_t &offset) const
Definition ASoA.cxx:301
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:3595
Concat(Ts const &... t, uint64_t offset=0)
Definition ASoA.h:3580
typename table_t::persistent_columns_t persistent_columns_t
Definition ASoA.h:3593
typename table_t::columns_t columns_t
Definition ASoA.h:3592
iterator const_iterator
Definition ASoA.h:3596
const_iterator unfiltered_const_iterator
Definition ASoA.h:3598
iterator unfiltered_iterator
Definition ASoA.h:3597
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Definition ASoA.h:3599
Concat(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:3575
filtered_iterator filtered_const_iterator
Definition ASoA.h:3600
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:4251
void bindExternalIndices(TA *... current)
Definition ASoA.h:4236
IndexTable(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
Definition ASoA.h:4246
typename base_t::template iterator_template_o< DefaultIndexPolicy, self_t > iterator
Definition ASoA.h:4261
filtered_iterator const_filtered_iterator
Definition ASoA.h:4264
IndexTable(IndexTable &&)=default
IndexTable & operator=(IndexTable const &)=default
iterator const_iterator
Definition ASoA.h:4262
IndexTable & operator=(IndexTable &&)=default
typename H::binding_t first_t
Definition ASoA.h:4229
typename base_t::template iterator_template_o< FilteredIndexPolicy, self_t > filtered_iterator
Definition ASoA.h:4263
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:3523
static constexpr const auto originalLabels
Definition ASoA.h:3492
iterator const_iterator
Definition ASoA.h:3496
Join(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Definition ASoA.h:3466
static constexpr const auto originals
Definition ASoA.h:3491
iterator rawIteratorAt(uint64_t i) const
Definition ASoA.h:3528
static constexpr const uint32_t binding_origin
Definition ASoA.h:3475
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3512
const_iterator unfiltered_const_iterator
Definition ASoA.h:3498
typename table_t::columns_t columns_t
Definition ASoA.h:3493
auto emptySlice() const
Definition ASoA.h:3545
Table< o2::aod::Hash<"JOIN"_h >, o2::aod::Hash<"JOIN/0"_h >, o2::aod::Hash<"JOIN"_h >, Ts... > base
Definition ASoA.h:3457
iterator iteratorAt(uint64_t i) const
Definition ASoA.h:3535
typename table_t::persistent_columns_t persistent_columns_t
Definition ASoA.h:3494
Join< Ts... > self_t
Definition ASoA.h:3489
const_iterator begin() const
Definition ASoA.h:3507
void bindExternalIndices(TA *... current)
Definition ASoA.h:3479
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
Definition ASoA.h:3495
static consteval bool contains()
Definition ASoA.h:3551
Join(std::shared_ptr< arrow::Table > &&table, uint64_t offset=0)
Definition ASoA.h:3459
iterator begin()
Definition ASoA.h:3502
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Definition ASoA.h:3499
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Definition ASoA.h:3517
auto rawSlice(uint64_t start, uint64_t end) const
Definition ASoA.h:3540
static constexpr const header::DataOrigin binding_origin_
Definition ASoA.h:3476
iterator unfiltered_iterator
Definition ASoA.h:3497
filtered_iterator filtered_const_iterator
Definition ASoA.h:3500
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:4273
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, std::span< int64_t const > const &selection, uint64_t offset=0)
Definition ASoA.h:4276
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Definition ASoA.h:4270
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:2050
TableIteratorBase(TableIteratorBase< IP, P, T... > const &other)
Definition ASoA.h:1958
typename Parent::columns_t columns_t
Definition ASoA.h:1905
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > const &other)
Definition ASoA.h:1944
typename Parent::external_index_columns_t external_index_columns_t
Definition ASoA.h:1906
TableIteratorBase operator-(int64_t dec) const
Definition ASoA.h:2045
void matchTo(TableIteratorBase< IP, P, T... > const &other)
Definition ASoA.h:1982
void matchTo(TableIteratorBase< IP, P, Os... > const &other)
Definition ASoA.h:1988
TableIteratorBase(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
Definition ASoA.h:1970
std::array< B, sizeof...(CCs)> getValues() const
Definition ASoA.h:2027
static constexpr auto originals
Definition ASoA.h:1909
TableIteratorBase(TableIteratorBase< IP, P, T... > &&other) noexcept
Definition ASoA.h:1964
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
Definition ASoA.h:1907
TableIteratorBase & operator=(TableIteratorBase< IP, P, Os... > other)
Definition ASoA.h:1921
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > &&other) noexcept
Definition ASoA.h:1951
TableIteratorBase & operator=(RowViewSentinel const &other)
Definition ASoA.h:1976
TableIteratorBase(arrow::ChunkedArray *columnData[framework::pack_size(columns_t{})], IP &&policy)
Definition ASoA.h:1915
TableIteratorBase & operator=(TableIteratorBase< IP, P, T... > other)
Definition ASoA.h:1929
TableIteratorBase operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
Definition ASoA.h:2038
TableIteratorBase & operator=(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
Definition ASoA.h:1936
unwrapper
Definition ASoA.h:497
VectorOfTObjectPtrs other
std::vector< ReadoutWindowData > rows
const std::string str