12#ifndef FRAMEWORK_GROUP_SLICER_H_
13#define FRAMEWORK_GROUP_SLICER_H_
18#include <arrow/util/config.h>
19#include <arrow/util/key_value_metadata.h>
25template <
typename G,
typename...
A>
53 requires(o2::soa::relatedByIndex<std::decay_t<G>, std::decay_t<T>>())
57 auto binding = o2::soa::getLabelFromTypeForKey<std::decay_t<T>>(
mIndexColumnName);
60 if (table.size() == 0) {
65 if (table.tableSize() == 0) {
77 template <soa::is_filtered_table T>
101 [&](
auto&&...
x) ->
void {
107 [&](
auto&&...
x) ->
void {
157 return std::make_tuple(prepareArgument<A>()...);
160 template <soa::is_smallgroups A1>
165 auto& originalTable = std::get<A1>(*
mAt);
177 if (!selection.empty()) {
178 std::copy(selection.begin(), selection.end(), std::back_inserter(s));
181 if (!selection.empty()) {
182 if constexpr (std::decay_t<A1>::applyFilters) {
185 std::copy(selection.begin(), selection.end(), std::back_inserter(s));
189 std::decay_t<A1> typedTable{{originalTable.asArrowTable()}, std::move(s)};
190 typedTable.bindInternalIndicesTo(&originalTable);
194 template <soa::is_filtered_table A1>
199 auto& originalTable = std::get<A1>(*
mAt);
200 if (originalTable.size() == 0) {
201 return originalTable;
211 uint64_t
offset = oc.first;
212 auto count = oc.second;
213 auto groupedElementsTable = originalTable.asArrowTable()->Slice(
offset,
count);
223 std::transform(slicedSelection.begin(), slicedSelection.end(), slicedSelection.begin(),
225 return idx - static_cast<int64_t>(offset);
228 std::decay_t<A1> typedTable{{groupedElementsTable}, std::move(slicedSelection),
offset};
229 typedTable.bindInternalIndicesTo(&originalTable);
233 template <soa::is_table A1>
238 auto& originalTable = std::get<A1>(*
mAt);
239 if (originalTable.size() == 0) {
240 return originalTable;
250 uint64_t
offset = oc.first;
251 auto count = oc.second;
253 groupedElementsTable.bindInternalIndicesTo(&originalTable);
254 return groupedElementsTable;
257 template <soa::is_table A1>
261 return std::get<A1>(*
mAt);
270 std::array<gsl::span<int64_t const>
const*,
sizeof...(A)>
selections;
271 std::array<gsl::span<int64_t const>::iterator,
sizeof...(A)>
starts;
#define O2_BUILTIN_LIKELY(x)
#define O2_BUILTIN_UNLIKELY(x)
GLsizei const GLchar *const * string
Defining PrimaryVertex explicitly as messageable.
std::string cutString(std::string &&str)
std::vector< int64_t > SelectionVector
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
SliceInfoPtr getCacheFor(StringPair const &bindingKey) const
SliceInfoUnsortedPtr getCacheUnsortedFor(StringPair const &bindingKey) const
std::array< SliceInfoUnsortedPtr, sizeof...(A)> sliceInfosUnsorted
GroupSlicerIterator(G >, std::tuple< A... > &at, ArrowTableSlicingCache &slices)
auto extractingFunction(T &&table)
GroupSlicerIterator operator+(int64_t inc) const
auto splittingFunction(T &&table)
std::array< SliceInfoPtr, sizeof...(A)> sliceInfos
GroupSlicerIterator & operator=(GroupSlicerIterator const &)=default
GroupSlicerIterator(GroupSlicerIterator &&)=default
gsl::span< int64_t const > groupSelection
bool operator!=(GroupSlicerSentinel const &other)
std::array< gsl::span< int64_t const > const *, sizeof...(A)> selections
GroupSlicerIterator & operator=(GroupSlicerIterator &&)=default
std::array< gsl::span< int64_t const >::iterator, sizeof...(A)> starts
GroupSlicerIterator operator+=(int64_t inc)
GroupSlicerIterator(GroupSlicerIterator const &)=default
GroupSlicerIterator & operator*()
GroupSlicerIterator & operator++()
GroupSlicerIterator()=default
std::string mIndexColumnName
auto splittingFunction(T &&)
bool operator==(GroupSlicerSentinel const &other)
auto extractingFunction(T &&)
grouping_t::iterator mGroupingElement
ArrowTableSlicingCache * mSlices
GroupSlicerSentinel end()
GroupSlicerIterator mBegin
GroupSlicer(G >, std::tuple< A... > &at, ArrowTableSlicingCache &slices)
std::decay_t< G > grouping_t
GroupSlicerIterator & begin()
VectorOfTObjectPtrs other