12#ifndef O2_FRAMEWORK_ASOA_H_
13#define O2_FRAMEWORK_ASOA_H_
26#include <arrow/table.h>
27#include <arrow/array.h>
28#include <arrow/util/config.h>
29#include <gandiva/selection_vector.h>
32#include <fmt/format.h>
40using ListVector = std::vector<std::vector<int64_t>>;
65 consteval TableRef(uint32_t _label, uint32_t _desc, uint32_t _origin, uint32_t _version)
79 return (this->label_hash ==
other.label_hash) &&
80 (this->desc_hash ==
other.desc_hash) &&
81 (this->origin_hash ==
other.origin_hash) &&
82 (this->version ==
other.version);
87 return this->desc_hash ==
other.desc_hash;
92 return this->desc_hash == _desc_hash;
102template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
105 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; }); });
106 std::array<TableRef, N1 + N2 - duplicates> out;
108 auto pos = std::copy(ar1.begin(), ar1.end(), out.begin());
109 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; }); });
113template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2,
typename L>
116 constexpr const int to_remove = std::ranges::count_if(ar1.begin(), ar1.end(), [&](
TableRef const&
a) { return !l(a); });
117 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); });
118 std::array<TableRef, N1 + N2 - duplicates - to_remove> out;
120 auto pos = std::copy_if(ar1.begin(), ar1.end(), out.begin(), [&](TableRef
const&
a) { return l(a); });
121 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); });
125template <
size_t N, std::array<TableRef, N> ar,
typename L>
128 constexpr const int to_remove = std::ranges::count_if(ar.begin(), ar.end(), [&l](
TableRef const& e) { return l(e); });
129 std::array<
TableRef, N - to_remove> out;
130 std::copy_if(ar.begin(), ar.end(), out.begin(), [&l](
TableRef const& e) { return !l(e); });
134template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
135consteval auto intersect()
137 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; }); });
138 std::array<TableRef, duplicates> out;
139 std::copy_if(ar1.begin(), ar1.end(), out.begin(), [](TableRef
const&
a) { return std::find(ar2.begin(), ar2.end(), a) != ar2.end(); });
143template <
typename T,
typename... Ts>
145 requires(
sizeof...(Ts) == 1)
148 return merge<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
151template <
typename T,
typename...
Ts>
153 requires(
sizeof...(Ts) > 1)
156 return merge<T::originals.size(), tail.size(), T::originals, tail>();
159template <
typename T,
typename...
Ts>
160 requires(
sizeof...(Ts) == 1)
161consteval auto intersectOriginals()
164 return intersect<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
167template <
typename T,
typename...
Ts>
168 requires(
sizeof...(Ts) > 1)
169consteval auto intersectOriginals()
172 return intersect<T::originals.size(), tail.size(), T::originals, tail>();
179concept not_void =
requires { !std::same_as<T, void>; };
198using is_external_index_t =
typename std::conditional_t<is_index_column<C>, std::true_type, std::false_type>;
201using is_self_index_t =
typename std::conditional_t<is_self_index_column<C>, std::true_type, std::false_type>;
207template <
typename D,
typename... Cs>
214 template <
typename Key,
typename... PCs>
217 return std::array<bool,
sizeof...(PCs)>{[]() {
218 if constexpr (
requires { PCs::index_targets.size(); }) {
219 return Key::template isIndexTargetOf<PCs::index_targets.size(), PCs::index_targets>();
226 template <
typename Key>
232 template <
typename Key,
size_t N, std::array<
bool, N> map>
235 constexpr const auto pos = std::find(map.begin(), map.end(),
true);
236 if constexpr (
pos != map.end()) {
237 return std::distance(map.begin(),
pos);
253 static constexpr uint32_t
hash = H;
254 static constexpr char const*
const str{
""};
258template <
size_t N, std::array<soa::TableRef, N> ar,
typename Key>
261 constexpr std::array<bool, N>
test = []<
size_t... Is>(std::index_sequence<Is...>) {
262 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))...};
263 }(std::make_index_sequence<N>());
264 constexpr int correct = std::ranges::count(
test.begin(),
test.end(),
true);
265 std::array<soa::TableRef, correct> out;
266 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))]; });
271#define O2HASH(_Str_) \
273 struct Hash<_Str_ ""_h> { \
274 static constexpr uint32_t hash = _Str_ ""_h; \
275 static constexpr char const* const str{_Str_}; \
279#define O2ORIGIN(_Str_) \
281 struct Hash<_Str_ ""_h> { \
282 static constexpr header::DataOrigin origin{_Str_}; \
283 static constexpr uint32_t hash = _Str_ ""_h; \
284 static constexpr char const* const str{_Str_}; \
288static inline constexpr uint32_t
version(
const char*
const str)
290 if (
str[0] ==
'\0') {
298 if (
str[
len - 1] ==
'\0') {
301 for (
auto i =
len + 1;
str[
i] !=
'\0'; ++
i) {
308static inline constexpr std::string_view description_str(
const char*
const str)
314 return std::string_view{
str,
len};
324 for (
auto i = 0;
i < 16; ++
i) {
327 std::memcpy(out,
str,
len);
332template <soa::TableRef R>
338template <soa::TableRef R>
344template <soa::TableRef R>
350template <soa::TableRef R>
364template <soa::TableRef R>
365static constexpr auto sourceSpec()
367 return fmt::format(
"{}/{}/{}/{}",
label<R>(), origin_str<R>(), description_str(signature<R>()),
R.version);
373template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O,
typename... Ts>
378 void const*
ptr =
nullptr;
380 std::span<TableRef const>
refs;
382 template <
typename T>
386 hash = o2::framework::TypeIdHelpers::uniqueId<T>();
387 refs = std::span{T::originals};
390 template <
typename T>
393 if (
hash == o2::framework::TypeIdHelpers::uniqueId<T>()) {
394 return static_cast<T const*
>(
ptr);
400template <
typename... C>
403 return std::vector<std::shared_ptr<arrow::Field>>{C::asArrowField()...};
426template <
typename B,
typename E>
428 constexpr static bool value =
false;
431template <aod::is_aod_hash A, aod::is_aod_hash B>
433 constexpr static bool value =
false;
436template <
typename B,
typename E>
439template <aod::is_aod_hash A, aod::is_aod_hash B>
478template <
typename T,
typename ChunkingPolicy = Chunked>
481 static constexpr char SCALE_FACTOR = std::same_as<std::decay_t<T>,
bool> ? 3 : 0;
497 auto array = getCurrentArray();
512 auto previousArray = getCurrentArray();
516 auto array = getCurrentArray();
523 auto previousArray = getCurrentArray();
527 auto array = getCurrentArray();
549 auto array = getCurrentArray();
555 decltype(
auto)
operator*()
const
556 requires std::same_as<bool, std::decay_t<T>>
562 decltype(
auto)
operator*()
const
563 requires((!std::same_as<bool, std::decay_t<T>>) && std::same_as<
arrow_array_for_t<T>, arrow::ListArray>)
572 decltype(
auto)
operator*()
const
573 requires((!std::same_as<bool, std::decay_t<T>>) && !std::same_as<
arrow_array_for_t<T>, arrow::ListArray>)
595 void checkSkipChunk() const
604 void checkSkipChunk() const
612 void checkSkipChunk() const
613 requires(ChunkingPolicy::
chunked == false)
617 auto getCurrentArray() const
621 mOffset = chunkToUse->offset();
622 chunkToUse = std::dynamic_pointer_cast<arrow::FixedSizeListArray>(chunkToUse)->values();
623 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
626 auto getCurrentArray() const
630 mOffset = chunkToUse->offset();
631 chunkToUse = std::dynamic_pointer_cast<arrow::ListArray>(chunkToUse)->values();
632 mOffset = chunkToUse->offset();
633 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
636 auto getCurrentArray() const
640 mOffset = chunkToUse->offset();
641 return std::static_pointer_cast<arrow_array_for_t<T>>(chunkToUse);
645template <
typename T,
typename INHERIT>
661 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
679template <
typename F,
typename INHERIT>
683 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
686template <
typename INHERIT>
690 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
693template <
typename INHERIT>
697 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
700template <
size_t M = 0>
704 constexpr inline static auto value = M;
719 static constexpr const char*
mLabel =
"Marker";
722template <int64_t START = 0, int64_t
END = -1>
725 constexpr inline static int64_t
start = START;
726 constexpr inline static int64_t
end =
END;
786 static constexpr const char*
mLabel =
"Index";
810using is_dynamic_t = std::conditional_t<is_dynamic_column<T>, std::true_type, std::false_type>;
816using is_indexing_t = std::conditional_t<is_indexing_column<T>, std::true_type, std::false_type>;
837 mSelectedRows(selection),
838 mMaxSelection(selection.
size()),
846 mSelectedRows = selection;
847 mMaxSelection = selection.size();
857 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
860 return std::make_tuple(&
mRowIndex, &mSelectionRow);
863 [[nodiscard]] std::tuple<uint64_t const*>
866 return std::make_tuple(&
mOffset);
873 mMaxSelection = std::min(
end, mMaxSelection);
891 return lh.mSelectionRow == rh.mSelectionRow;
904 this->mSelectionRow = this->mMaxSelection;
910 return mSelectionRow;
913 [[nodiscard]]
auto size()
const
915 return mMaxSelection;
924 inline void updateRow()
928 gsl::span<int64_t const> mSelectedRows;
929 int64_t mSelectionRow = 0;
930 int64_t mMaxSelection = 0;
965 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
971 [[nodiscard]] std::tuple<uint64_t const*>
974 return std::make_tuple(&
mOffset);
1015template <
typename T>
1020template <
typename C>
1026template <
typename T,
typename B>
1028 { t.B::mColumnIterator };
1031template <
typename...
C>
1034template <
typename D,
typename O,
typename IP,
typename... C>
1062 this->limitRange(this->rangeStart(), this->rangeEnd());
1068 C(static_cast<
C const&>(
other))...
1075 IP::operator=(
static_cast<IP const&
>(
other));
1076 (
void(
static_cast<C&
>(*
this) =
static_cast<C>(
other)), ...);
1082 requires std::same_as<IP, DefaultIndexPolicy>
1084 C(
static_cast<C const&
>(
other))...
1091 this->moveByIndex(1);
1104 this->moveByIndex(-1);
1119 copy.moveByIndex(inc);
1133 template <
typename... CL,
typename TA>
1136 (CL::setCurrent(current), ...);
1139 template <
typename CL>
1142 return CL::getCurrentRaw();
1145 template <
typename... Cs>
1148 return std::vector<o2::soa::Binding>{
static_cast<Cs const&
>(*this).getCurrentRaw()...};
1156 template <
typename... TA>
1162 template <
typename... Cs>
1165 (Cs::setCurrentRaw(ptrs[framework::has_type_at_v<Cs>(p)]), ...);
1168 template <
typename... Cs,
typename I>
1173 (Cs::setCurrentRaw(
b), ...);
1181 template <
typename I>
1189 template <
typename... PC>
1192 (PC::mColumnIterator.moveToEnd(), ...);
1202 [
this]<soa::is_dynamic_column T>(T*) ->
void { bindDynamicColumn<T>(
typename T::bindings_t{}); },
1203 [
this]<
typename T>(
T*) ->
void {},
1205 (
f(
static_cast<C*
>(
nullptr)), ...);
1206 if constexpr (has_index<
C...>) {
1207 this->setIndices(this->getIndices());
1208 this->setOffsets(this->getOffsets());
1212 template <
typename DC,
typename...
B>
1215 DC::boundIterators = std::make_tuple(getDynamicBinding<B>()...);
1223 template <
typename B>
1224 requires(can_bind<self_t, B>)
1225 decltype(
auto) getDynamicBinding()
1227 static_assert(std::same_as<decltype(&(static_cast<B*>(
this)->mColumnIterator)), std::decay_t<
decltype(B::mColumnIterator)>*>,
"foo");
1228 return &(
static_cast<B*
>(
this)->mColumnIterator);
1232 template <
typename B>
1233 decltype(
auto) getDynamicBinding()
1235 return static_cast<std::decay_t<decltype(B::mColumnIterator)
>*>(
nullptr);
1240 static std::shared_ptr<arrow::Table>
joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
1241 static std::shared_ptr<arrow::Table>
concatTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
1245template <
typename T>
1248template <
typename T>
1250 T::originals.size();
1253template <
typename T>
1258template <
typename T>
1261template <
size_t N1, std::array<TableRef, N1> os1,
size_t N2, std::array<TableRef, N2> os2>
1264 return []<
size_t... Is>(std::index_sequence<Is...>) {
1265 return ([]<
size_t... Ks>(std::index_sequence<Ks...>) {
1266 constexpr auto h = os1[Is].desc_hash;
1269 }(std::make_index_sequence<N2>()) ||
1271 }(std::make_index_sequence<N1>());
1274template <with_originals T, with_originals B>
1277 return is_compatible<T::originals.size(), T::originals, B::originals.size(), B::originals>();
1280template <
typename T,
typename B>
1281using is_binding_compatible = std::conditional_t<is_binding_compatible_v<T, typename B::binding_t>(), std::true_type, std::false_type>;
1283template <
typename L,
typename D,
typename O,
typename Key,
typename H,
typename...
Ts>
1286template <
typename T>
1289template <soa::is_table T>
1290static constexpr std::string getLabelForTable()
1292 return std::string{aod::label<std::decay_t<T>::originals[0]>()};
1295template <soa::is_table T>
1297static constexpr std::string getLabelFromType()
1299 return getLabelForTable<T>();
1302template <soa::is_iterator T>
1303static constexpr std::string getLabelFromType()
1305 return getLabelForTable<typename std::decay_t<T>::parent_t>();
1308template <soa::is_index_table T>
1309static constexpr std::string getLabelFromType()
1311 return getLabelForTable<typename std::decay_t<T>::first_t>();
1313template <soa::with_base_table T>
1314static constexpr std::string getLabelFromType()
1319template <
typename...
C>
1322 return ((C::inherited_t::mLabel ==
key) || ...);
1325template <TableRef ref>
1326static constexpr std::pair<bool, std::string> hasKey(std::string
const&
key)
1331template <
typename...
C>
1334 return std::vector{hasKey<C>(
key)...};
1340template <with_originals T,
bool OPT = false>
1341static constexpr std::string getLabelFromTypeForKey(std::string
const&
key)
1343 if constexpr (T::originals.size() == 1) {
1344 auto locate = hasKey<T::originals[0]>(
key);
1346 return locate.second;
1349 auto locate = [&]<
size_t... Is>(std::index_sequence<Is...>) {
1350 return std::vector{hasKey<T::originals[Is]>(
key)...};
1351 }(std::make_index_sequence<T::originals.size()>{});
1352 auto it = std::find_if(locate.begin(), locate.end(), [](
auto const&
x) { return x.first; });
1353 if (it != locate.end()) {
1357 if constexpr (!OPT) {
1365template <
typename B,
typename...
C>
1368 return (o2::soa::is_binding_compatible_v<B, typename C::binding_t>() || ...);
1371template <
typename B,
typename...
C>
1374 return ((C::sorted && o2::soa::is_binding_compatible_v<B, typename C::binding_t>()) || ...);
1377template <
typename B,
typename Z>
1378consteval static bool relatedByIndex()
1380 return hasIndexTo<B>(
typename Z::table_t::external_index_columns_t{});
1383template <
typename B,
typename Z>
1384consteval static bool relatedBySortedIndex()
1386 return hasSortedIndexTo<B>(
typename Z::table_t::external_index_columns_t{});
1405 std::shared_ptr<arrow::Table>
getSliceFor(
int value, std::shared_ptr<arrow::Table>
const& input, uint64_t&
offset)
const;
1415template <
typename T,
typename Policy,
bool OPT = false>
1423 : Policy{
PreslicePolicyBase{{o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.
name})}, std::make_pair(o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.name}), std::string{index_.name})}, {}}
1429 if constexpr (OPT) {
1430 if (Policy::isMissing()) {
1439 if constexpr (OPT) {
1440 if (Policy::isMissing()) {
1444 return Policy::getSliceFor(
value);
1448template <
typename T>
1450template <
typename T>
1452template <
typename T>
1454template <
typename T>
1457template <
typename T>
1464template <soa::is_table T>
1466template <
typename T>
1469template <
typename T>
1472template <
typename T>
1475template <
typename T>
1479template <
typename T>
1482template <
typename T>
1485template <
typename T>
1489template <
typename... Is>
1497template <
typename T,
typename C,
typename Policy,
bool OPT>
1498 requires std::same_as<Policy, framework::PreslicePolicySorted> && (o2::soa::is_binding_compatible_v<C, T>())
1501 if constexpr (OPT) {
1502 if (container.isMissing()) {
1508 auto t =
typename T::self_t({out},
offset);
1509 table->copyIndexBindings(t);
1510 t.bindInternalIndicesTo(table);
1514template <soa::is_filtered_table T>
1519 t.bindInternalIndicesTo(table);
1520 t.intersectWithSelection(table->getSelectedRows());
1524template <soa::is_table T>
1530 t.bindInternalIndicesTo(table);
1534template <
typename T,
typename C,
typename Policy,
bool OPT>
1535 requires std::same_as<Policy, framework::PreslicePolicyGeneral> && (o2::soa::is_binding_compatible_v<C, T>())
1538 if constexpr (OPT) {
1539 if (container.isMissing()) {
1549template <soa::is_filtered_table T>
1552 if (
offset >=
static_cast<uint64_t
>(table->tableSize())) {
1563template <soa::is_filtered_table T,
typename C,
bool OPT>
1564 requires(o2::soa::is_binding_compatible_v<C, T>())
1567 if constexpr (OPT) {
1568 if (container.isMissing()) {
1577template <
typename T>
1582 auto t =
typename T::self_t({table->asArrowTable()->Slice(
static_cast<uint64_t
>(
offset),
count)},
static_cast<uint64_t
>(
offset));
1583 table->copyIndexBindings(t);
1587template <
typename T>
1592 auto slice = table->asArrowTable()->Slice(
static_cast<uint64_t
>(
offset),
count);
1596template <
typename T>
1601 auto t =
typename T::self_t({table->asArrowTable()}, localCache.getSliceFor(
value));
1602 t.intersectWithSelection(table->getSelectedRows());
1603 table->copyIndexBindings(t);
1606 auto t =
Filtered<T>({table->asArrowTable()}, localCache.getSliceFor(
value));
1607 table->copyIndexBindings(t);
1612template <with_originals T>
1620template <
typename D,
typename O,
typename IP,
typename...
C>
1657 return std::array<TableRef, 1>{
ref};
1673 static constexpr const auto ref =
TableRef{L::hash, D::hash, O::hash, o2::aod::version(D::str)};
1679 template <
size_t N, std::array<TableRef, N> bindings>
1680 requires(
ref.origin_hash ==
"CONC"_h)
1686 template <
size_t N, std::array<TableRef, N> bindings>
1687 requires(
ref.origin_hash ==
"JOIN"_h)
1692 return std::find(bindings.begin(), bindings.end(),
r) != bindings.end();
1696 template <
size_t N, std::array<TableRef, N> bindings>
1697 requires(!(
ref.origin_hash ==
"CONC"_h ||
ref.origin_hash ==
"JOIN"_h))
1700 return std::find(bindings.begin(), bindings.end(),
self_t::ref) != bindings.end();
1703 template <TableRef r>
1716 template <
typename IP>
1719 template <
typename IP,
typename Parent,
typename... T>
1736 template <
typename P,
typename... Os>
1738 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1744 template <
typename P>
1751 template <
typename P>
1753 requires std::same_as<IP, DefaultIndexPolicy>
1759 template <
typename P,
typename O1,
typename... Os>
1761 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1766 template <
typename P,
typename O1,
typename... Os>
1768 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1773 template <
typename P>
1779 template <
typename P>
1785 template <
typename P>
1787 requires std::same_as<IP, DefaultIndexPolicy>
1794 this->mRowIndex =
other.index;
1797 template <
typename P>
1800 this->mRowIndex =
other.mRowIndex;
1803 template <
typename P,
typename... Os>
1805 requires std::same_as<typename P::table_t, typename Parent::table_t>
1807 this->mRowIndex =
other.mRowIndex;
1810 template <
typename TI>
1813 using decayed = std::decay_t<TI>;
1815 constexpr auto idx = framework::has_type_at_v<decayed>(
bindings_pack_t{});
1817 }
else if constexpr (std::same_as<decayed, Parent>) {
1818 return this->globalIndex();
1820 return this->globalIndex();
1822 return static_cast<int32_t
>(-1);
1826 template <
typename CD,
typename... CDArgs>
1829 using decayed = std::decay_t<CD>;
1831 return static_cast<decayed
>(*this).template getDynamicValue<CDArgs...>();
1834 template <
typename B,
typename CC>
1837 using COL = std::decay_t<CC>;
1839 return static_cast<B>(
static_cast<COL
>(*this).get());
1842 template <
typename B,
typename... CCs>
1845 static_assert(std::same_as<B, float> || std::same_as<B, double>,
"The common return type should be float or double");
1846 return {getValue<B, CCs>()...};
1857 copy.moveByIndex(inc);
1872 template <
typename IP,
typename Parent,
typename... T>
1875 template <
typename IP,
typename Parent>
1878 if constexpr (
sizeof...(Ts) == 0) {
1889 template <
typename IP,
typename Parent>
1901 return []<
typename...
C>(
framework::pack<
C...>) {
return std::set{{o2::framework::TypeIdHelpers::uniqueId<C>()...}}; }(
columns_t{});
1906 mEnd{table->num_rows()},
1909 if (mTable->num_rows() == 0) {
1911 mColumnChunks[ci] =
nullptr;
1917 mColumnChunks[ci] = lookups[ci];
1920 mBegin.bindInternalIndices(
this);
1924 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t
offset = 0)
1925 requires(
ref.origin_hash !=
"CONC"_h)
1930 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t
offset = 0)
1931 requires(
ref.origin_hash ==
"CONC"_h)
1936 template <
typename Key>
1940 return std::array<bool,
sizeof...(Cs)>{[]() {
1941 if constexpr (
requires { Cs::index_targets.size(); }) {
1942 return Key::template
isIndexTargetOf<Cs::index_targets.size(), Cs::index_targets>();
1948 constexpr auto pos = std::find(map.begin(), map.end(),
true);
1949 if constexpr (
pos != map.end()) {
1950 return mColumnChunks[std::distance(map.begin(),
pos)];
1952 static_assert(framework::always_static_assert_v<Key>,
"This table does not have an index to given Key");
1982 return filtered_iterator(mColumnChunks, {selection, mTable->num_rows(), mOffset});
2020 return mTable->num_rows();
2030 template <
typename... TA>
2033 mBegin.bindExternalIndices(current...);
2036 template <
typename I>
2039 mBegin.bindInternalIndices(
ptr);
2047 template <
typename... Cs>
2050 (
static_cast<Cs
>(mBegin).setCurrentRaw(binding), ...);
2055 mBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
2058 template <
typename T,
typename... Cs>
2061 dest.bindExternalIndicesRaw(mBegin.getIndexBindings());
2064 template <
typename T>
2087 template <
typename T1,
typename Policy,
bool OPT>
2100 return self_t{mTable->Slice(0, 0), 0};
2104 template <
typename T>
2105 arrow::ChunkedArray* lookupColumn()
2108 auto label = T::columnLabel();
2114 std::shared_ptr<arrow::Table> mTable =
nullptr;
2115 uint64_t mOffset = 0;
2122template <uint32_t
D, soa::is_column...
C>
2128namespace row_helpers
2139 return std::array<std::shared_ptr<arrow::Array>,
sizeof...(Cs)>{
o2::soa::getIndexFromLabel(table, Cs::columnLabel())->chunk(ci)...};
2142template <
typename T, soa::is_persistent_column C>
2143typename C::type
getSingleRowData(arrow::Table* table, T& rowIterator, uint64_t ci = std::numeric_limits<uint64_t>::max(), uint64_t ai = std::numeric_limits<uint64_t>::max(), uint64_t globalIndex = std::numeric_limits<uint64_t>::max())
2145 if (ci == std::numeric_limits<uint64_t>::max() || ai == std::numeric_limits<uint64_t>::max()) {
2146 auto colIterator =
static_cast<C>(rowIterator).getIterator();
2147 ci = colIterator.mCurrentChunk;
2148 ai = *(colIterator.mCurrentPos) - colIterator.mFirstIndex;
2150 return std::static_pointer_cast<o2::soa::arrow_array_for_t<typename C::type>>(
o2::soa::getIndexFromLabel(table, C::columnLabel())->chunk(ci))->raw_values()[ai];
2153template <
typename T, soa::is_dynamic_column C>
2154typename C::type
getSingleRowData(arrow::Table*, T& rowIterator, uint64_t ci = std::numeric_limits<uint64_t>::max(), uint64_t ai = std::numeric_limits<uint64_t>::max(), uint64_t globalIndex = std::numeric_limits<uint64_t>::max())
2156 if (globalIndex != std::numeric_limits<uint64_t>::max() && globalIndex != *std::get<0>(rowIterator.getIndices())) {
2157 rowIterator.setCursor(globalIndex);
2159 return rowIterator.template getDynamicColumn<C>();
2162template <
typename T, soa::is_index_column C>
2163typename C::type
getSingleRowData(arrow::Table*, T& rowIterator, uint64_t ci = std::numeric_limits<uint64_t>::max(), uint64_t ai = std::numeric_limits<uint64_t>::max(), uint64_t globalIndex = std::numeric_limits<uint64_t>::max())
2165 if (globalIndex != std::numeric_limits<uint64_t>::max() && globalIndex != *std::get<0>(rowIterator.getIndices())) {
2166 rowIterator.setCursor(globalIndex);
2168 return rowIterator.template getId<C>();
2171template <
typename T,
typename... Cs>
2172std::tuple<
typename Cs::type...>
getRowData(arrow::Table* table, T rowIterator, uint64_t ci = std::numeric_limits<uint64_t>::max(), uint64_t ai = std::numeric_limits<uint64_t>::max(), uint64_t globalIndex = std::numeric_limits<uint64_t>::max())
2174 return std::make_tuple(getSingleRowData<T, Cs>(table, rowIterator, ci, ai, globalIndex)...);
2179template <
typename R,
typename T,
typename C>
2180R getColumnValue(
const T& rowIterator)
2182 return static_cast<R>(
static_cast<C>(rowIterator).get());
2185template <
typename R,
typename T>
2186using ColumnGetterFunction =
R (*)(
const T&);
2188template <
typename T,
typename R>
2193 { t.get() } -> std::convertible_to<R>;
2196template <
typename T,
typename R>
2198 { t.get() } -> std::convertible_to<R>;
2201template <
typename R,
typename T, persistent_with_common_getter<R> C>
2202ColumnGetterFunction<R, T> createGetterPtr(
const std::string_view& targetColumnLabel)
2204 return targetColumnLabel == C::columnLabel() ? &getColumnValue<R, T, C> :
nullptr;
2207template <
typename R,
typename T, dynamic_with_common_getter<R> C>
2208ColumnGetterFunction<R, T> createGetterPtr(
const std::string_view& targetColumnLabel)
2210 std::string_view columnLabel(C::columnLabel());
2214 if (targetColumnLabel.starts_with(
"f") && targetColumnLabel.substr(1) == columnLabel) {
2215 return &getColumnValue<R, T, C>;
2219 if (targetColumnLabel == columnLabel) {
2220 return &getColumnValue<R, T, C>;
2226template <
typename R,
typename T,
typename... Cs>
2229 ColumnGetterFunction<R, T>
func;
2231 (
void)((
func = createGetterPtr<R, T, Cs>(targetColumnLabel),
func) || ...);
2240template <
typename T,
typename R>
2241using 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;
2244template <
typename R,
typename T>
2249 if (targetColumnLabel.size() == 0) {
2253 return getColumnGetterByLabel<R, typename T::iterator>(TypesWithCommonGetter{}, targetColumnLabel);
2273#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \
2275 struct EquivalentIndexNG<o2::aod::Hash<_Base_::ref.desc_hash>, o2::aod::Hash<_Equiv_::ref.desc_hash>> { \
2276 constexpr static bool value = true; \
2279#define DECLARE_EQUIVALENT_FOR_INDEX_NG(_Base_, _Equiv_) \
2281 struct EquivalentIndexNG<o2::aod::Hash<_Base_ ""_h>, o2::aod::Hash<_Equiv_ ""_h>> { \
2282 constexpr static bool value = true; \
2285#define DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
2286 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2287 static constexpr const char* mLabel = _Label_; \
2288 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2289 using base = o2::soa::Column<_Type_, _Name_>; \
2290 using type = _Type_; \
2291 using column_t = _Name_; \
2292 _Name_(arrow::ChunkedArray const* column) \
2293 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2297 _Name_() = default; \
2298 _Name_(_Name_ const& other) = default; \
2299 _Name_& operator=(_Name_ const& other) = default; \
2301 decltype(auto) _Getter_() const \
2303 return *mColumnIterator; \
2306 decltype(auto) get() const \
2308 return _Getter_(); \
2311 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, o2::framework::TypeIdHelpers::uniqueId<_Name_>(), \
2312 o2::framework::expressions::selectArrowType<_Type_>() }
2314#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_) \
2315 DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_)
2319#define MAKEINT(_Size_) uint##_Size_##_t
2321#define DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, _Label_) \
2322 struct _Name_ : o2::soa::Column<MAKEINT(_Size_), _Name_> { \
2323 static constexpr const char* mLabel = _Label_; \
2324 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2325 using base = o2::soa::Column<MAKEINT(_Size_), _Name_>; \
2326 using type = MAKEINT(_Size_); \
2327 _Name_(arrow::ChunkedArray const* column) \
2328 : o2::soa::Column<type, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2332 _Name_() = default; \
2333 _Name_(_Name_ const& other) = default; \
2334 _Name_& operator=(_Name_ const& other) = default; \
2336 decltype(auto) _Getter_##_raw() const \
2338 return *mColumnIterator; \
2341 bool _Getter_##_bit(int bit) const \
2343 return (*mColumnIterator & (static_cast<type>(1) << bit)) >> bit; \
2346 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, o2::framework::TypeIdHelpers::uniqueId<_Name_>(), \
2347 o2::framework::expressions::selectArrowType<MAKEINT(_Size_)>() }
2349#define DECLARE_SOA_BITMAP_COLUMN(_Name_, _Getter_, _Size_) \
2350 DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, "f" #_Name_)
2354#define DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_, _Expression_) \
2355 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2356 static constexpr const char* mLabel = _Label_; \
2357 using base = o2::soa::Column<_Type_, _Name_>; \
2358 using type = _Type_; \
2359 using column_t = _Name_; \
2360 using spawnable_t = std::true_type; \
2361 _Name_(arrow::ChunkedArray const* column) \
2362 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2366 _Name_() = default; \
2367 _Name_(_Name_ const& other) = default; \
2368 _Name_& operator=(_Name_ const& other) = default; \
2370 decltype(auto) _Getter_() const \
2372 return *mColumnIterator; \
2375 decltype(auto) get() const \
2377 return _Getter_(); \
2380 static o2::framework::expressions::Projector Projector() \
2382 return _Expression_; \
2385 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, o2::framework::TypeIdHelpers::uniqueId<_Name_>(), \
2386 o2::framework::expressions::selectArrowType<_Type_>() }
2388#define DECLARE_SOA_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Expression_) \
2389 DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_, _Expression_);
2412template <o2::soa::is_table T>
2415 return T::originals;
2418#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2419 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2420 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2421 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2422 static constexpr const char* mLabel = "fIndexSlice" _Label_ _Suffix_; \
2423 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2424 using type = _Type_[2]; \
2425 using column_t = _Name_##IdSlice; \
2426 using binding_t = _Table_; \
2427 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2428 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2429 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2433 _Name_##IdSlice() = default; \
2434 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2435 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2436 std::array<_Type_, 2> inline getIds() const \
2438 return _Getter_##Ids(); \
2441 bool has_##_Getter_() const \
2443 auto a = *mColumnIterator; \
2444 return a[0] >= 0 && a[1] >= 0; \
2447 std::array<_Type_, 2> _Getter_##Ids() const \
2449 auto a = *mColumnIterator; \
2450 return std::array{a[0], a[1]}; \
2453 template <typename T> \
2454 auto _Getter_##_as() const \
2456 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2457 o2::soa::notBoundTable(#_Table_); \
2459 auto t = mBinding.get<T>(); \
2460 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2461 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2463 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2464 return t->emptySlice(); \
2466 auto a = *mColumnIterator; \
2467 auto r = t->rawSlice(a[0], a[1]); \
2468 t->copyIndexBindings(r); \
2469 r.bindInternalIndicesTo(t); \
2473 auto _Getter_() const \
2475 return _Getter_##_as<binding_t>(); \
2478 template <typename T> \
2479 bool setCurrent(T const* current) \
2481 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2482 assert(current != nullptr); \
2483 this->mBinding.bind(current); \
2489 bool setCurrentRaw(o2::soa::Binding current) \
2491 this->mBinding = current; \
2494 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2495 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2496 o2::soa::Binding mBinding; \
2499#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_)
2500#define DECLARE_SOA_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2501#define DECLARE_SOA_SLICE_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2504#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2505 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
2506 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2507 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2508 static constexpr const char* mLabel = "fIndexArray" _Label_ _Suffix_; \
2509 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
2510 using type = std::vector<_Type_>; \
2511 using column_t = _Name_##Ids; \
2512 using binding_t = _Table_; \
2513 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2514 _Name_##Ids(arrow::ChunkedArray const* column) \
2515 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
2519 _Name_##Ids() = default; \
2520 _Name_##Ids(_Name_##Ids const& other) = default; \
2521 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
2523 gsl::span<const _Type_> inline getIds() const \
2525 return _Getter_##Ids(); \
2528 gsl::span<const _Type_> _Getter_##Ids() const \
2530 return *mColumnIterator; \
2533 bool has_##_Getter_() const \
2535 return !(*mColumnIterator).empty(); \
2538 template <typename T> \
2539 auto _Getter_##_as() const \
2541 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2542 o2::soa::notBoundTable(#_Table_); \
2544 auto t = mBinding.get<T>(); \
2545 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2546 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2548 return getIterators<T>(); \
2551 template <typename T> \
2552 auto filtered_##_Getter_##_as() const \
2554 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2555 o2::soa::notBoundTable(#_Table_); \
2557 auto t = mBinding.get<T>(); \
2558 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2559 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2561 return getFilteredIterators<T>(); \
2564 template <typename T> \
2565 auto getIterators() const \
2567 auto result = std::vector<typename T::unfiltered_iterator>(); \
2568 for (auto& i : *mColumnIterator) { \
2569 result.push_back(mBinding.get<T>()->rawIteratorAt(i)); \
2574 template <typename T> \
2575 std::vector<typename T::iterator> getFilteredIterators() const \
2577 if constexpr (o2::soa::is_filtered_table<T>) { \
2578 auto result = std::vector<typename T::iterator>(); \
2579 for (auto const& i : *mColumnIterator) { \
2580 auto pos = mBinding.get<T>()->isInSelectedRows(i); \
2582 result.emplace_back(mBinding.get<T>()->iteratorAt(pos)); \
2587 static_assert(o2::framework::always_static_assert_v<T>, "T is not a Filtered type"); \
2592 auto _Getter_() const \
2594 return _Getter_##_as<binding_t>(); \
2597 template <typename T> \
2598 auto _Getter_##_first_as() const \
2600 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2601 o2::soa::notBoundTable(#_Table_); \
2603 auto t = mBinding.get<T>(); \
2604 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2605 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2607 return t->rawIteratorAt((*mColumnIterator)[0]); \
2610 template <typename T> \
2611 auto _Getter_##_last_as() const \
2613 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2614 o2::soa::notBoundTable(#_Table_); \
2616 auto t = mBinding.get<T>(); \
2617 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2618 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2620 return t->rawIteratorAt((*mColumnIterator).back()); \
2623 auto _Getter_first() const \
2625 return _Getter_##_first_as<binding_t>(); \
2628 auto _Getter_last() const \
2630 return _Getter_##_last_as<binding_t>(); \
2633 template <typename T> \
2634 bool setCurrent(T const* current) \
2636 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2637 assert(current != nullptr); \
2638 this->mBinding.bind(current); \
2644 bool setCurrentRaw(o2::soa::Binding current) \
2646 this->mBinding = current; \
2649 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2650 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2651 o2::soa::Binding mBinding; \
2654#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_)
2655#define DECLARE_SOA_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2656#define DECLARE_SOA_ARRAY_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2659#define DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2660 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2661 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2662 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2663 static constexpr const char* mLabel = "fIndex" _Label_ _Suffix_; \
2664 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2665 using type = _Type_; \
2666 using column_t = _Name_##Id; \
2667 using binding_t = _Table_; \
2668 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2669 _Name_##Id(arrow::ChunkedArray const* column) \
2670 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2674 _Name_##Id() = default; \
2675 _Name_##Id(_Name_##Id const& other) = default; \
2676 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2677 type inline getId() const \
2679 return _Getter_##Id(); \
2682 type _Getter_##Id() const \
2684 return *mColumnIterator; \
2687 bool has_##_Getter_() const \
2689 return *mColumnIterator >= 0; \
2692 template <typename T> \
2693 auto _Getter_##_as() const \
2695 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2696 o2::soa::notBoundTable(#_Table_); \
2698 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2699 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2701 auto t = mBinding.get<T>(); \
2702 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2703 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2705 return t->rawIteratorAt(*mColumnIterator); \
2708 auto _Getter_() const \
2710 return _Getter_##_as<binding_t>(); \
2713 template <typename T> \
2714 bool setCurrent(T* current) \
2716 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2717 assert(current != nullptr); \
2718 this->mBinding.bind(current); \
2724 bool setCurrentRaw(o2::soa::Binding current) \
2726 this->mBinding = current; \
2729 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2730 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2731 o2::soa::Binding mBinding; \
2733 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" #_Table_ _Suffix_, o2::framework::TypeIdHelpers::uniqueId<_Name_##Id>(), \
2734 o2::framework::expressions::selectArrowType<_Type_>() }
2736#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2737#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2738#define DECLARE_SOA_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2741#define DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2742 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2743 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2744 static constexpr const char* mLabel = "fIndex" _Label_; \
2745 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2746 using type = _Type_; \
2747 using column_t = _Name_##Id; \
2748 using self_index_t = std::true_type; \
2749 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2750 _Name_##Id(arrow::ChunkedArray const* column) \
2751 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2755 _Name_##Id() = default; \
2756 _Name_##Id(_Name_##Id const& other) = default; \
2757 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2758 type inline getId() const \
2760 return _Getter_##Id(); \
2763 type _Getter_##Id() const \
2765 return *mColumnIterator; \
2768 bool has_##_Getter_() const \
2770 return *mColumnIterator >= 0; \
2773 template <typename T> \
2774 auto _Getter_##_as() const \
2776 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2777 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2779 auto t = mBinding.get<T>(); \
2780 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2781 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2783 return t->rawIteratorAt(*mColumnIterator); \
2786 bool setCurrentRaw(o2::soa::Binding current) \
2788 this->mBinding = current; \
2791 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2792 o2::soa::Binding mBinding; \
2794 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_, o2::framework::TypeIdHelpers::uniqueId<_Name_##Id>(), \
2795 o2::framework::expressions::selectArrowType<_Type_>() }
2797#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
2798#define DECLARE_SOA_SELF_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
2800#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2801 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2802 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2803 static constexpr const char* mLabel = "fIndexSlice" _Label_; \
2804 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2805 using type = _Type_[2]; \
2806 using column_t = _Name_##IdSlice; \
2807 using self_index_t = std::true_type; \
2808 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2809 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2810 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2814 _Name_##IdSlice() = default; \
2815 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2816 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2817 std::array<_Type_, 2> inline getIds() const \
2819 return _Getter_##Ids(); \
2822 bool has_##_Getter_() const \
2824 auto a = *mColumnIterator; \
2825 return a[0] >= 0 && a[1] >= 0; \
2828 std::array<_Type_, 2> _Getter_##Ids() const \
2830 auto a = *mColumnIterator; \
2831 return std::array{a[0], a[1]}; \
2834 template <typename T> \
2835 auto _Getter_##_as() const \
2837 auto t = mBinding.get<T>(); \
2838 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2839 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2841 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2842 return t->emptySlice(); \
2844 auto a = *mColumnIterator; \
2845 auto r = t->rawSlice(a[0], a[1]); \
2846 t->copyIndexBindings(r); \
2847 r.bindInternalIndicesTo(t); \
2851 bool setCurrentRaw(o2::soa::Binding current) \
2853 this->mBinding = current; \
2856 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2857 o2::soa::Binding mBinding; \
2860#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
2861#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
2863#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2864 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
2865 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2866 static constexpr const char* mLabel = "fIndexArray" _Label_; \
2867 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
2868 using type = std::vector<_Type_>; \
2869 using column_t = _Name_##Ids; \
2870 using self_index_t = std::true_type; \
2871 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2872 _Name_##Ids(arrow::ChunkedArray const* column) \
2873 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
2877 _Name_##Ids() = default; \
2878 _Name_##Ids(_Name_##Ids const& other) = default; \
2879 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
2880 gsl::span<const _Type_> inline getIds() const \
2882 return _Getter_##Ids(); \
2885 gsl::span<const _Type_> _Getter_##Ids() const \
2887 return *mColumnIterator; \
2890 bool has_##_Getter_() const \
2892 return !(*mColumnIterator).empty(); \
2895 template <typename T> \
2896 auto _Getter_##_as() const \
2898 auto t = mBinding.get<T>(); \
2899 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2900 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2902 return getIterators<T>(); \
2905 template <typename T> \
2906 auto getIterators() const \
2908 auto result = std::vector<typename T::unfiltered_iterator>(); \
2909 for (auto& i : *mColumnIterator) { \
2910 result.push_back(mBinding.get<T>()->rawIteratorAt(i)); \
2915 template <typename T> \
2916 auto _Getter_##_first_as() const \
2918 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator)[0]); \
2921 template <typename T> \
2922 auto _Getter_##_last_as() const \
2924 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator).back()); \
2927 bool setCurrentRaw(o2::soa::Binding current) \
2929 this->mBinding = current; \
2932 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2933 o2::soa::Binding mBinding; \
2936#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
2937#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
2967#define DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_, ...) \
2968 struct _Name_##Callback { \
2969 static inline constexpr auto getLambda() { return __VA_ARGS__; } \
2972 struct _Name_##Helper { \
2973 using callable_t = decltype(o2::framework::FunctionMetadata(std::declval<decltype(_Name_##Callback::getLambda())>())); \
2974 using return_type = typename callable_t::return_type; \
2976 template <typename... Bindings> \
2977 struct _Name_ : o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>> { \
2978 using base = o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>>; \
2979 using helper = _Name_##Helper; \
2980 using callback_holder_t = _Name_##Callback; \
2981 using callable_t = helper::callable_t; \
2982 using callback_t = callable_t::type; \
2984 _Name_(arrow::ChunkedArray const*) \
2987 _Name_() = default; \
2988 _Name_(_Name_ const& other) = default; \
2989 _Name_& operator=(_Name_ const& other) = default; \
2990 static constexpr const char* mLabel = #_Name_; \
2991 using type = typename callable_t::return_type; \
2993 template <typename... FreeArgs> \
2994 type _Getter_(FreeArgs... freeArgs) const \
2996 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
2998 template <typename... FreeArgs> \
2999 type getDynamicValue(FreeArgs... freeArgs) const \
3001 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3006 return _Getter_(); \
3009 template <size_t... Is, typename... FreeArgs> \
3010 type boundGetter(std::integer_sequence<size_t, Is...>&&, FreeArgs... freeArgs) const \
3012 return __VA_ARGS__((**std::get<Is>(boundIterators))..., freeArgs...); \
3015 using bindings_t = typename o2::framework::pack<Bindings...>; \
3016 std::tuple<o2::soa::ColumnIterator<typename Bindings::type> const*...> boundIterators; \
3019#define DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, ...) \
3020 using _Name_##Metadata = TableMetadata<Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__>;
3022#define DECLARE_SOA_TABLE_METADATA_TRAIT(_Name_, _Desc_, _Version_) \
3024 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3025 using metadata = _Name_##Metadata; \
3028#define DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_) \
3029 O2HASH(_Desc_ "/" #_Version_); \
3030 template <typename O> \
3031 using _Name_##From = o2::soa::Table<Hash<_Label_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3032 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>; \
3034 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3035 using metadata = _Name_##Metadata; \
3038#define DECLARE_SOA_STAGE(_Name_, _Origin_, _Desc_, _Version_) \
3039 template <typename O> \
3040 using _Name_##From = o2::soa::Table<Hash<#_Name_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3041 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>;
3043#define DECLARE_SOA_TABLE_FULL_VERSIONED(_Name_, _Label_, _Origin_, _Desc_, _Version_, ...) \
3044 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3045 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_);
3047#define DECLARE_SOA_TABLE_FULL(_Name_, _Label_, _Origin_, _Desc_, ...) \
3049 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, 0, __VA_ARGS__); \
3050 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, 0)
3052#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_, ...) \
3053 DECLARE_SOA_TABLE_FULL(_Name_, #_Name_, _Origin_, _Desc_, __VA_ARGS__)
3055#define DECLARE_SOA_TABLE_VERSIONED(_Name_, _Origin_, _Desc_, _Version_, ...) \
3057 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3058 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, #_Name_, _Origin_, _Desc_, _Version_)
3060#define DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, _Version_, ...) \
3061 O2HASH(_Desc_ "/" #_Version_); \
3062 O2HASH(#_BaseName_); \
3063 O2HASH("Stored" #_BaseName_); \
3064 DECLARE_SOA_TABLE_METADATA(_BaseName_, _Desc_, _Version_, __VA_ARGS__); \
3065 using Stored##_BaseName_##Metadata = _BaseName_##Metadata; \
3066 DECLARE_SOA_TABLE_METADATA_TRAIT(_BaseName_, _Desc_, _Version_); \
3067 DECLARE_SOA_STAGE(_BaseName_, "AOD", _Desc_, _Version_); \
3068 DECLARE_SOA_STAGE(Stored##_BaseName_, "AOD1", _Desc_, _Version_);
3070#define DECLARE_SOA_TABLE_STAGED(_BaseName_, _Desc_, ...) \
3071 DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, 0, __VA_ARGS__);
3073#define DECLARE_SOA_EXTENDED_TABLE_FULL(_Name_, _Label_, _OriginalTable_, _Origin_, _Desc_, _Version_, ...) \
3074 O2HASH(_Desc_ "/" #_Version_); \
3075 template <typename O> \
3076 using _Name_##ExtensionFrom = soa::Table<o2::aod::Hash<_Label_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3077 using _Name_##Extension = _Name_##ExtensionFrom<o2::aod::Hash<_Origin_ ""_h>>; \
3078 template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3079 struct _Name_##ExtensionMetadataFrom : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3080 using base_table_t = _OriginalTable_; \
3081 using extension_table_t = _Name_##ExtensionFrom<O>; \
3082 using expression_pack_t = framework::pack<__VA_ARGS__>; \
3083 static constexpr auto sources = _OriginalTable_::originals; \
3085 using _Name_##ExtensionMetadata = _Name_##ExtensionMetadataFrom<o2::aod::Hash<_Origin_ ""_h>>; \
3087 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3088 using metadata = _Name_##ExtensionMetadata; \
3090 template <typename O> \
3091 using _Name_##From = o2::soa::JoinFull<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, _OriginalTable_, _Name_##ExtensionFrom<O>>; \
3092 using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ ""_h>>;
3094#define DECLARE_SOA_EXTENDED_TABLE(_Name_, _Table_, _Description_, _Version_, ...) \
3095 O2HASH(#_Name_ "Extension"); \
3096 DECLARE_SOA_EXTENDED_TABLE_FULL(_Name_, #_Name_ "Extension", _Table_, "DYN", _Description_, _Version_, __VA_ARGS__)
3098#define DECLARE_SOA_EXTENDED_TABLE_USER(_Name_, _Table_, _Description_, ...) \
3099 O2HASH(#_Name_ "Extension"); \
3100 DECLARE_SOA_EXTENDED_TABLE_FULL(_Name_, #_Name_ "Extension", _Table_, "AOD", "EX" _Description_, 0, __VA_ARGS__)
3102#define DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, _Origin_, _Version_, _Desc_, _Exclusive_, ...) \
3104 O2HASH(_Desc_ "/" #_Version_); \
3105 template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3106 struct _Name_##MetadataFrom : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3107 static constexpr bool exclusive = _Exclusive_; \
3108 using Key = _Key_; \
3109 using index_pack_t = framework::pack<__VA_ARGS__>; \
3110 static constexpr const auto sources = []<typename... Cs>(framework::pack<Cs...>) { \
3111 constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3112 return o2::aod::filterForKey<a.size(), a, Key>(); \
3113 }(framework::pack<__VA_ARGS__>{}); \
3115 using _Name_##Metadata = _Name_##MetadataFrom<o2::aod::Hash<_Origin_ ""_h>>; \
3117 template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3118 using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_, __VA_ARGS__>; \
3119 using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ ""_h>>; \
3122 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3123 using metadata = _Name_##Metadata; \
3126#define DECLARE_SOA_INDEX_TABLE(_Name_, _Key_, _Description_, ...) \
3127 DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, "IDX", 0, _Description_, false, __VA_ARGS__)
3129#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE(_Name_, _Key_, _Description_, ...) \
3130 DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, "IDX", 0, _Description_, true, __VA_ARGS__)
3132#define DECLARE_SOA_INDEX_TABLE_USER(_Name_, _Key_, _Description_, ...) \
3133 DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, "AOD", 0, _Description_, false, __VA_ARGS__)
3135#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE_USER(_Name_, _Key_, _Description_, ...) \
3136 DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, "AOD", 0, _Description_, true, __VA_ARGS__)
3140template <
typename D,
typename...
Ts>
3141struct JoinFull :
Table<o2::aod::Hash<"JOIN"_h>, D, o2::aod::Hash<"JOIN"_h>, Ts...> {
3189 template <
typename T1,
typename Policy,
bool OPT>
3217 template <
typename T>
3224template <
typename...
Ts>
3227template <
typename...
Ts>
3233template <
typename T>
3236template <
typename T>
3239template <
typename...
Ts>
3240struct Concat :
Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...> {
3243 Concat(std::vector<std::shared_ptr<arrow::Table>>&& tables, uint64_t
offset = 0)
3251 bindInternalIndicesTo(
this);
3254 using base::originals;
3256 using base::bindExternalIndices;
3257 using base::bindInternalIndicesTo;
3271template <
typename...
Ts>
3277template <soa::is_table T>
3288 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3294 mSelectedRows{getSpan(selection)}
3296 if (this->tableSize() != 0) {
3297 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3300 mFilteredBegin.bindInternalIndices(
this);
3305 mSelectedRowsCache{
std::move(selection)},
3308 mSelectedRows = gsl::span{mSelectedRowsCache};
3309 if (this->tableSize() != 0) {
3310 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3313 mFilteredBegin.bindInternalIndices(
this);
3316 FilteredBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gsl::span<int64_t const>
const& selection, uint64_t
offset = 0)
3318 mSelectedRows{selection}
3320 if (this->tableSize() != 0) {
3321 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3324 mFilteredBegin.bindInternalIndices(
this);
3351 return mFilteredBegin;
3356 return mFilteredBegin;
3361 return mFilteredBegin +
i;
3366 return mSelectedRows.size();
3371 return table_t::asArrowTable()->num_rows();
3376 return mSelectedRows;
3382 newSelection.resize(
static_cast<int64_t
>(
end -
start + 1));
3383 std::iota(newSelection.begin(), newSelection.end(),
start);
3384 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3394 if (sel ==
nullptr) {
3395 return gsl::span<int64_t const>{};
3397 auto array = std::static_pointer_cast<arrow::Int64Array>(sel->ToArray());
3400 return gsl::span{
start, stop};
3405 template <
typename... TA>
3408 table_t::bindExternalIndices(current...);
3409 mFilteredBegin.bindExternalIndices(current...);
3414 mFilteredBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
3417 template <
typename I>
3420 mFilteredBegin.bindInternalIndices(
ptr);
3423 template <
typename T1,
typename... Cs>
3426 dest.bindExternalIndicesRaw(mFilteredBegin.getIndexBindings());
3429 template <
typename T1>
3435 template <
typename T1>
3451 template <
typename T1,
bool OPT>
3457 template <
typename T1,
bool OPT>
3466 copyIndexBindings(t);
3472 auto locate = std::find(mSelectedRows.begin(), mSelectedRows.end(),
i);
3473 if (locate == mSelectedRows.end()) {
3476 return static_cast<int>(std::distance(mSelectedRows.begin(), locate));
3483 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3484 mSelectedRowsCache.clear();
3485 mSelectedRowsCache = rowsUnion;
3493 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3494 mSelectedRowsCache.clear();
3495 mSelectedRowsCache = intersection;
3503 std::set_union(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(rowsUnion));
3504 mSelectedRowsCache.clear();
3505 mSelectedRowsCache = rowsUnion;
3513 std::set_intersection(mSelectedRows.begin(), mSelectedRows.end(), selection.begin(), selection.end(), std::back_inserter(intersection));
3514 mSelectedRowsCache.clear();
3515 mSelectedRowsCache = intersection;
3528 mSelectedRows = gsl::span{mSelectedRowsCache};
3530 mFilteredEnd.reset(
new RowViewSentinel{
static_cast<int64_t
>(mSelectedRows.size())});
3531 if (tableSize() == 0) {
3532 mFilteredBegin = *mFilteredEnd;
3534 mFilteredBegin.resetSelection(mSelectedRows);
3538 gsl::span<int64_t const> mSelectedRows;
3540 bool mCached =
false;
3541 iterator mFilteredBegin;
3542 std::shared_ptr<RowViewSentinel> mFilteredEnd;
3545template <
typename T>
3554 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3560 return iterator(this->cached_begin());
3574 Filtered(std::vector<std::shared_ptr<arrow::Table>>&& tables, gsl::span<int64_t const>
const& selection, uint64_t
offset = 0)
3598 this->sumWithSelection(selection);
3604 this->sumWithSelection(selection);
3610 return operator+=(
other.getSelectedRows());
3629 return operator*(
other.getSelectedRows());
3634 this->intersectWithSelection(selection);
3640 this->intersectWithSelection(selection);
3646 return operator*=(
other.getSelectedRows());
3661 newSelection.resize(
static_cast<int64_t
>(
end -
start + 1));
3662 std::iota(newSelection.begin(), newSelection.end(),
start);
3663 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3671 template <
typename T1>
3687 template <
typename T1,
bool OPT>
3693 template <
typename T1,
bool OPT>
3702 copyIndexBindings(t);
3707template <
typename T>
3716 using iterator =
typename T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3722 return iterator(this->cached_begin());
3733 for (
auto& table : tables) {
3741 for (
auto& table : tables) {
3749 for (
auto& table : tables) {
3775 this->sumWithSelection(selection);
3781 this->sumWithSelection(selection);
3787 return operator+=(
other.getSelectedRows());
3793 copy.intersectionWithSelection(selection);
3800 copy.intersectionWithSelection(selection);
3806 return operator*(
other.getSelectedRows());
3811 this->intersectWithSelection(selection);
3817 this->intersectWithSelection(selection);
3823 return operator*=(
other.getSelectedRows());
3836 newSelection.resize(
static_cast<int64_t
>(
end -
start + 1));
3837 std::iota(newSelection.begin(), newSelection.end(),
start);
3838 return self_t{{this->asArrowTable()}, std::move(newSelection), 0};
3856 template <
typename T1,
bool OPT>
3862 template <
typename T1,
bool OPT>
3869 std::vector<std::shared_ptr<arrow::Table>> extractTablesFromFiltered(std::vector<
Filtered<T>>& tables)
3871 std::vector<std::shared_ptr<arrow::Table>> outTables;
3872 for (
auto& table : tables) {
3873 outTables.push_back(table.asArrowTable());
3884template <
typename L,
typename D,
typename O,
typename Key,
typename H,
typename...
Ts>
3915template <
typename T,
bool APPLY>
3917 static constexpr bool applyFilters = APPLY;
3924 SmallGroupsBase(std::vector<std::shared_ptr<arrow::Table>>&& tables, gsl::span<int64_t const>
const& selection, uint64_t
offset = 0)
3928template <
typename T>
3931template <
typename T>
3934template <
typename T>
#define O2HASH(_Str_)
Pre-declare Hash specialization for a generic string.
#define O2ORIGIN(_Str_)
Pre-declare Hash specialization for an origin string.
consteval auto getIndexTargets()
SLICE.
o2::monitoring::tags::Key Key
#define O2_BUILTIN_UNREACHABLE
#define O2_BUILTIN_LIKELY(x)
#define O2_BUILTIN_UNLIKELY(x)
Class for time synchronization of RawReader instances.
int64_t const * mCurrentPos
ColumnIterator(arrow::ChunkedArray const *column)
ColumnIterator(ColumnIterator< T, ChunkingPolicy > const &)=default
void moveToEnd()
Move the iterator to the end of the column.
ColumnIterator< T > & moveToPos()
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > const &)=default
unwrap_t< T > const * mCurrent
unwrap_t< T > const * mLast
ColumnIterator(ColumnIterator< T, ChunkingPolicy > &&)=default
arrow::ChunkedArray const * mColumn
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > &&)=default
void moveToChunk(int chunk)
void nextChunk() const
Move the iterator to the next chunk.
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gsl::span< int64_t const > const &selection, uint64_t offset=0)
int64_t tableSize() const
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
typename T::external_index_columns_t external_index_columns_t
auto select(framework::expressions::Filter const &f) const
static auto getSpan(gandiva::Selection const &sel)
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
void copyIndexBindings(T1 &dest) const
auto const & getSelectedRows() const
typename T::columns_t columns_t
void bindExternalIndices(TA *... current)
void sumWithSelection(SelectionVector const &selection)
void bindInternalIndicesTo(I const *ptr)
void intersectWithSelection(SelectionVector const &selection)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
auto rawSlice(uint64_t start, uint64_t end) const
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
iterator iteratorAt(uint64_t i) const
typename T::table_t table_t
typename T::persistent_columns_t persistent_columns_t
RowViewSentinel end() const
void intersectWithSelection(gsl::span< int64_t const > const &selection)
FilteredBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
const_iterator begin() const
unfiltered_iterator rawIteratorAt(uint64_t i) const
int isInSelectedRows(int i) const
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
void doCopyIndexBindings(framework::pack< Cs... >, T1 &dest) const
void sumWithSelection(gsl::span< int64_t const > const &selection)
auto const & cached_begin() const
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
typename FilteredBase< typename T::table_t >::table_t table_t
Filtered< Filtered< T > > operator+=(gsl::span< int64_t const > const &selection)
typename T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
Filtered< Filtered< T > > operator+(SelectionVector const &selection)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Filtered< Filtered< T > > operator*(gsl::span< int64_t const > const &selection)
typename T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
typename T::columns_t columns_t
const_iterator begin() const
Filtered(std::vector< Filtered< T > > &&tables, SelectionVector &&selection, uint64_t offset=0)
unfiltered_iterator rawIteratorAt(uint64_t i) const
Filtered< Filtered< T > > operator+=(Filtered< T > const &other)
Filtered< Filtered< T > > operator+=(SelectionVector const &selection)
Filtered< Filtered< T > > operator*=(SelectionVector const &selection)
auto rawSlice(uint64_t start, uint64_t end) const
Filtered< Filtered< T > > operator+(Filtered< T > const &other)
Filtered(std::vector< Filtered< T > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
Filtered< Filtered< T > > operator*=(Filtered< T > const &other)
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered< Filtered< T > > operator*=(gsl::span< int64_t const > const &selection)
Filtered< Filtered< T > > operator*(Filtered< T > const &other)
Filtered< Filtered< T > > operator+(gsl::span< int64_t const > const &selection)
Filtered< Filtered< T > > operator*(SelectionVector const &selection)
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered(std::vector< Filtered< T > > &&tables, gsl::span< int64_t const > const &selection, uint64_t offset=0)
Filtered< T > operator+=(Filtered< T > const &other)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, gsl::span< int64_t const > const &selection, uint64_t offset=0)
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered< T > operator+(Filtered< T > const &other)
Filtered< T > operator*=(SelectionVector const &selection)
const_iterator begin() const
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
auto select(framework::expressions::Filter const &f) const
Filtered< T > operator+(SelectionVector const &selection)
Filtered< T > operator*(gsl::span< int64_t const > const &selection)
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
unfiltered_iterator rawIteratorAt(uint64_t i) const
Filtered< T > operator*(SelectionVector const &selection)
Filtered< T > operator*=(Filtered< T > const &other)
Filtered< T > operator*(Filtered< T > const &other)
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
Filtered< T > operator+=(SelectionVector const &selection)
Filtered< T > operator*=(gsl::span< int64_t const > const &selection)
Filtered< T > operator+(gsl::span< int64_t const > const &selection)
Filtered< T > operator+=(gsl::span< int64_t const > const &selection)
auto rawSlice(uint64_t start, uint64_t end) const
Filtered(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
typename T::table_t table_t
typename T::columns_t columns_t
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_self_index_t, C... > {}(columns_t{})) internal_index_columns_t
void bindInternalIndicesExplicit(o2::soa::Binding binding)
iterator iteratorAt(uint64_t i) const
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_persistent_column_t, C... > {}(columns_t{})) persistent_columns_t
static constexpr const auto ref
auto offset() const
Return offset.
static consteval bool hasOriginal()
unfiltered_iterator begin()
int64_t tableSize() const
auto rawSlice(uint64_t start, uint64_t end) const
void bindExternalIndices(TA *... current)
auto select(framework::expressions::Filter const &f) const
unfiltered_iterator unfiltered_const_iterator
static consteval auto full_iter()
auto const & cached_begin() const
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
TableIteratorBase< IP, Parent, T... > iterator_template
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
static constexpr auto hashes()
iterator unfiltered_iterator
std::shared_ptr< arrow::Table > asArrowTable() const
Return a type erased arrow table backing store for / the type safe table.
void doCopyIndexBindings(framework::pack< Cs... >, T &dest) const
int64_t size() const
Size of the table, in rows.
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
decltype(getColumns< ref, Ts... >()) columns_t
arrow::ChunkedArray * getIndexToKey()
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::type... > {}(persistent_columns_t{})) column_types
static consteval auto isIndexTargetOf()
iterator_template_o< FilteredIndexPolicy, table_t > filtered_iterator
unfiltered_const_iterator begin() const
void copyIndexBindings(T &dest) const
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
Table< L, D, O, Ts... > self_t
static consteval auto isIndexTargetOf()
decltype(full_iter< IP, Parent >()) iterator_template_o
void doBindInternalIndicesExplicit(framework::pack< Cs... >, o2::soa::Binding binding)
static constexpr const auto originals
decltype([]< typename... C >(framework::pack< C... > &&) -> framework::selected_pack< soa::is_external_index_t, C... > {}(columns_t{})) external_index_columns_t
Table(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
RowViewSentinel end() const
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
void bindInternalIndicesTo(I const *ptr)
unfiltered_iterator rawIteratorAt(uint64_t i) const
filtered_iterator filtered_begin(gsl::span< int64_t const > selection)
iterator_template_o< DefaultIndexPolicy, table_t > iterator
hash identification concepts
Helper to check if a type T is an iterator.
column identification concepts
GLuint GLsizei const GLuint const GLintptr * offsets
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
GLuint GLsizei GLsizei * length
GLuint GLsizei const GLchar * label
GLsizei GLenum const void * indices
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLenum GLsizei len
GLboolean GLboolean GLboolean GLboolean a
std::shared_ptr< gandiva::SelectionVector > Selection
consteval const char * origin_str()
consteval const char * signature()
consteval auto filterForKey()
Filter TableRef array for compatibility with Key table.
consteval const char * label()
consteval header::DataOrigin origin()
std::shared_ptr< arrow::DataType > concreteArrowType(atype::type type)
gandiva::Selection createSelection(std::shared_ptr< arrow::Table > const &table, Filter const &expression)
Function for creating gandiva selection from our internal filter tree.
Defining PrimaryVertex explicitly as messageable.
std::decay_t< decltype(select_pack< Condition >(pack<>{}, Pack{}, CondPack{}))> selected_pack_multicondition
std::decay_t< decltype(prune_voids_pack(pack<>{}, with_condition_pack< Condition, Types... >{}))> selected_pack
decltype(intersected_pack(Ps{}...)) full_intersected_pack_t
typename pack_element< I, T >::type pack_element_t
consteval size_t has_type_at_v(pack< Ts... >)
constexpr std::size_t pack_size(pack< Ts... > const &)
template function to determine number of types in a pack
decltype(concatenate_pack_unique(Ps{}...)) concatenated_pack_unique_t
std::pair< std::string, std::string > StringPair
std::string strToUpper(std::string &&str)
typename pack_element< 0, T >::type pack_head_t
std::string cutString(std::string &&str)
std::vector< std::vector< int64_t > > ListVector
std::array< std::shared_ptr< arrow::Array >, sizeof...(Cs)> getChunks(arrow::Table *table, framework::pack< Cs... >, uint64_t ci)
ColumnGetterFunction< R, typename T::iterator > getColumnGetterByLabel(const std::string_view &targetColumnLabel)
std::array< arrow::ChunkedArray *, sizeof...(Cs)> getArrowColumns(arrow::Table *table, framework::pack< Cs... >)
std::tuple< typename Cs::type... > getRowData(arrow::Table *table, T rowIterator, uint64_t ci=std::numeric_limits< uint64_t >::max(), uint64_t ai=std::numeric_limits< uint64_t >::max(), uint64_t globalIndex=std::numeric_limits< uint64_t >::max())
C::type getSingleRowData(arrow::Table *table, T &rowIterator, uint64_t ci=std::numeric_limits< uint64_t >::max(), uint64_t ai=std::numeric_limits< uint64_t >::max(), uint64_t globalIndex=std::numeric_limits< uint64_t >::max())
consteval auto computeOriginals()
auto createFieldsFromColumns(framework::pack< C... >)
SelectionVector selectionToVector(gandiva::Selection const &sel)
constexpr bool is_persistent_v
constexpr bool is_ng_index_equivalent_v
consteval auto remove_if(L l)
constexpr auto join(Ts const &... t)
auto doSliceBy(T const *table, o2::framework::PresliceBase< C, Policy, OPT > const &container, int value)
SelectionVector sliceSelection(gsl::span< int64_t const > const &mSelectedRows, int64_t nrows, uint64_t offset)
void notBoundTable(const char *tableName)
auto doFilteredSliceBy(T const *table, o2::framework::PresliceBase< C, framework::PreslicePolicySorted, OPT > const &container, int value)
constexpr auto concat(Ts const &... t)
consteval auto intersectOriginals()
consteval auto getColumns()
std::vector< int64_t > SelectionVector
std::conditional_t< is_binding_compatible_v< T, typename B::binding_t >(), std::true_type, std::false_type > is_binding_compatible
consteval auto mergeOriginals()
constexpr bool is_soa_filtered_v
typename std::conditional_t< is_index_column< C >, std::true_type, std::false_type > is_external_index_t
void missingFilterDeclaration(int hash, int ai)
auto doSliceByCachedUnsorted(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
auto doSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
void accessingInvalidIndexFor(const char *getter)
auto select(T const &t, framework::expressions::Filter const &f)
consteval auto base_iter(framework::pack< C... > &&) -> TableIterator< D, O, IP, C... >
constexpr bool is_index_equivalent_v
constexpr bool is_soa_join_v
void dereferenceWithWrongType(const char *getter, const char *target)
std::conditional_t< is_indexing_column< T >, std::true_type, std::false_type > is_indexing_t
auto doSliceByHelper(T const *table, gsl::span< const int64_t > const &selection)
consteval bool is_binding_compatible_v()
auto prepareFilteredSlice(T const *table, std::shared_ptr< arrow::Table > slice, uint64_t offset)
typename unwrap< T >::type unwrap_t
void getterNotFound(const char *targetColumnLabel)
auto doFilteredSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
void missingOptionalPreslice(const char *label, const char *key)
consteval bool is_compatible()
arrow::ChunkedArray * getIndexFromLabel(arrow::Table *table, std::string_view label)
consteval auto merge()
Helpers to manipulate TableRef arrays.
consteval auto merge_if(L l)
std::conditional_t< is_persistent_column< C >, std::true_type, std::false_type > is_persistent_column_t
typename arrow_array_for< T >::type arrow_array_for_t
void notFoundColumn(const char *label, const char *key)
std::conditional_t< is_dynamic_column< T >, std::true_type, std::false_type > is_dynamic_t
typename std::conditional_t< is_self_index_column< C >, std::true_type, std::false_type > is_self_index_t
Defining DataPointCompositeObject explicitly as copiable.
FIXME: do not use data model tables.
static constexpr uint32_t hash
static constexpr char const *const str
SliceInfoPtr getCacheFor(StringPair const &bindingKey) const
SliceInfoUnsortedPtr getCacheUnsortedFor(StringPair const &bindingKey) const
std::shared_ptr< arrow::Table > getSliceFor(int value, std::shared_ptr< arrow::Table > const &input, uint64_t &offset) const
static constexpr bool optional
PresliceBase(expressions::BindingNode index_)
gsl::span< const int64_t > getSliceFor(int value) const
const std::string binding
StringPair const & getBindingKey() const
const std::string binding
SliceInfoUnsortedPtr sliceInfo
gsl::span< const int64_t > getSliceFor(int value) const
void updateSliceInfo(SliceInfoUnsortedPtr &&si)
void updateSliceInfo(SliceInfoPtr &&si)
std::shared_ptr< arrow::Table > getSliceFor(int value, std::shared_ptr< arrow::Table > const &input, uint64_t &offset) const
ArrowTableSlicingCache * ptr
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)
static std::shared_ptr< arrow::Table > concatTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
Type-checking index column binding.
std::span< TableRef const > refs
void bind(T const *table)
static constexpr bool chunked
arrow::ChunkedArray * second
Column(ColumnIterator< T > const &it)
static constexpr const char *const & columnLabel()
ColumnIterator< T > const & getIterator() const
Column & operator=(Column const &)=default
Column(Column &&)=default
static auto asArrowField()
Column & operator=(Column &&)=default
Column(Column const &)=default
ColumnIterator< T > mColumnIterator
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
Concat(Ts const &... t, uint64_t offset=0)
typename table_t::persistent_columns_t persistent_columns_t
typename table_t::columns_t columns_t
const_iterator unfiltered_const_iterator
iterator unfiltered_iterator
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Concat(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
filtered_iterator filtered_const_iterator
DefaultIndexPolicy(int64_t nRows, uint64_t offset)
friend bool operator==(DefaultIndexPolicy const &lh, DefaultIndexPolicy const &rh)
bool operator==(RowViewSentinel const &sentinel) const
DefaultIndexPolicy(FilteredIndexPolicy const &other)
std::tuple< uint64_t const * > getOffsets() const
DefaultIndexPolicy & operator=(DefaultIndexPolicy &&)=default
void setCursor(int64_t i)
void limitRange(int64_t start, int64_t end)
DefaultIndexPolicy(DefaultIndexPolicy &&)=default
DefaultIndexPolicy(DefaultIndexPolicy const &)=default
DefaultIndexPolicy & operator=(DefaultIndexPolicy const &)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
DefaultIndexPolicy()=default
Needed to be able to copy the policy.
void moveByIndex(int64_t i)
static constexpr const char *const & columnLabel()
void resetSelection(gsl::span< int64_t const > selection)
FilteredIndexPolicy & operator=(FilteredIndexPolicy &&)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
FilteredIndexPolicy & operator=(FilteredIndexPolicy const &)=default
auto getSelectionRow() const
FilteredIndexPolicy()=default
friend bool operator==(FilteredIndexPolicy const &lh, FilteredIndexPolicy const &rh)
void setCursor(int64_t i)
FilteredIndexPolicy(FilteredIndexPolicy const &)=default
bool operator==(RowViewSentinel const &sentinel) const
std::tuple< uint64_t const * > getOffsets() const
void limitRange(int64_t start, int64_t end)
FilteredIndexPolicy(gsl::span< int64_t const > selection, int64_t rows, uint64_t offset=0)
FilteredIndexPolicy(FilteredIndexPolicy &&)=default
void moveByIndex(int64_t i)
static constexpr bool chunked
static constexpr const char *const & columnLabel()
uint64_t mOffset
Offset within a larger table.
int64_t mRowIndex
Position inside the current table.
IndexTable(std::vector< std::shared_ptr< arrow::Table > > tables, uint64_t offset=0)
IndexTable(std::shared_ptr< arrow::Table > table, uint64_t offset=0)
typename base_t::template iterator_template_o< DefaultIndexPolicy, self_t > iterator
filtered_iterator const_filtered_iterator
IndexTable(IndexTable &&)=default
IndexTable & operator=(IndexTable const &)=default
IndexTable & operator=(IndexTable &&)=default
typename H::binding_t first_t
typename base_t::template iterator_template_o< FilteredIndexPolicy, self_t > filtered_iterator
IndexTable(IndexTable const &)=default
Index(Index const &)=default
void setIndices(std::tuple< int64_t const *, int64_t const * > indices)
Index & operator=(Index &&)=default
Index(arrow::ChunkedArray const *)
int64_t filteredIndex() const
constexpr int64_t rangeEnd()
constexpr int64_t rangeStart()
Index & operator=(Index const &)=default
int64_t globalIndex() const
std::tuple< int64_t const *, int64_t const * > rowIndices
void setOffsets(std::tuple< uint64_t const * > offsets)
static constexpr const char * mLabel
std::tuple< uint64_t const * > rowOffsets
iterator unfiltered_iterator
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
auto rawSlice(uint64_t start, uint64_t end) const
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
JoinFull(std::vector< std::shared_ptr< arrow::Table > > &&tables, uint64_t offset=0)
const_iterator unfiltered_const_iterator
filtered_iterator filtered_const_iterator
static consteval bool contains()
iterator iteratorAt(uint64_t i) const
typename table_t::columns_t columns_t
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
static constexpr const auto originals
JoinFull< D, Ts... > self_t
const_iterator begin() const
typename table_t::persistent_columns_t persistent_columns_t
iterator rawIteratorAt(uint64_t i) const
Table< o2::aod::Hash<"JOIN"_h >, D, o2::aod::Hash<"JOIN"_h >, Ts... > base
JoinFull(std::shared_ptr< arrow::Table > &&table, uint64_t offset=0)
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
static constexpr const char *const & columnLabel()
Marker & operator=(Marker const &)=default
static constexpr auto value
static constexpr const char * mLabel
Marker(arrow::ChunkedArray const *)
Marker(Marker const &)=default
Marker & operator=(Marker &&)=default
Marker(Marker &&)=default
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, SelectionVector &&selection, uint64_t offset=0)
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gsl::span< int64_t const > const &selection, uint64_t offset=0)
SmallGroupsBase(std::vector< std::shared_ptr< arrow::Table > > &&tables, gandiva::Selection const &selection, uint64_t offset=0)
framework::selected_pack< soa::is_persistent_column_t, C... > persistent_columns_t
void doSetCurrentIndexRaw(framework::pack< Cs... > p, std::vector< o2::soa::Binding > &&ptrs)
void bindInternalIndices(I const *table)
TableIterator(TableIterator< D, O, FilteredIndexPolicy, C... > const &other)
TableIterator(self_t const &other)
TableIterator operator-(int64_t dec) const
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
TableIterator & operator=(TableIterator other)
TableIterator & operator++()
void doSetCurrentInternal(framework::pack< Cs... >, I const *ptr)
auto getIndexBindingsImpl(framework::pack< Cs... >) const
TableIterator operator--(int)
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
decltype([]< typename... Cs >(framework::pack< Cs... >) -> framework::pack< typename Cs::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
void bindExternalIndices(TA *... current)
TableIterator & operator--()
framework::selected_pack< soa::is_external_index_t, C... > external_index_columns_t
TableIterator const & operator*() const
TableIterator operator++(int)
framework::selected_pack< soa::is_self_index_t, C... > internal_index_columns_t
auto getIndexBindings() const
void doSetCurrentIndex(framework::pack< CL... >, TA *current)
TableIterator operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
Generic identifier for a table type.
constexpr TableRef & operator=(TableRef const &)=default
constexpr bool descriptionCompatible(uint32_t _desc_hash) const noexcept
constexpr bool operator==(TableRef const &other) const noexcept
constexpr TableRef(TableRef &&)=default
constexpr TableRef(TableRef const &)=default
consteval TableRef(uint32_t _label, uint32_t _desc, uint32_t _origin, uint32_t _version)
constexpr bool descriptionCompatible(TableRef const &other) const noexcept
constexpr TableRef & operator=(TableRef &&)=default
TableIteratorBase const & operator*() const
TableIteratorBase(TableIteratorBase< IP, P, T... > const &other)
typename Parent::columns_t columns_t
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > const &other)
typename Parent::external_index_columns_t external_index_columns_t
TableIteratorBase operator-(int64_t dec) const
void matchTo(TableIteratorBase< IP, P, T... > const &other)
auto getDynamicColumn() const
TableIteratorBase()=default
void matchTo(TableIteratorBase< IP, P, Os... > const &other)
TableIteratorBase(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
std::array< B, sizeof...(CCs)> getValues() const
static constexpr auto originals
TableIteratorBase(TableIteratorBase< IP, P, T... > &&other) noexcept
decltype([]< typename... C >(framework::pack< C... >) -> framework::pack< typename C::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
TableIteratorBase & operator=(TableIteratorBase< IP, P, Os... > other)
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > &&other) noexcept
TableIteratorBase & operator=(RowViewSentinel const &other)
TableIteratorBase(arrow::ChunkedArray *columnData[framework::pack_size(columns_t{})], IP &&policy)
TableIteratorBase & operator=(TableIteratorBase< IP, P, T... > other)
TableIteratorBase operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
TableIteratorBase & operator=(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
VectorOfTObjectPtrs other
std::vector< ReadoutWindowData > rows