Skip to content

Commit

Permalink
split splitting and extracting functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aalkin committed Jan 7, 2025
1 parent 2784cc1 commit e8ff6cc
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions Framework/Core/include/Framework/GroupSlicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,42 @@ struct GroupSlicer {
GroupSlicerIterator& operator=(GroupSlicerIterator&&) = default;

template <typename T>
auto splittingFunction(T&&)
{
}

template <typename T>
requires (o2::soa::relatedByIndex<std::decay_t<G>, std::decay_t<T>>())
auto splittingFunction(T&& table)
{
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
if constexpr (o2::soa::relatedByIndex<std::decay_t<G>, std::decay_t<T>>()) {
auto binding = o2::soa::getLabelFromTypeForKey<std::decay_t<T>>(mIndexColumnName);
auto bk = std::make_pair(binding, mIndexColumnName);
if constexpr (!o2::soa::is_smallgroups<std::decay_t<T>>) {
if (table.size() == 0) {
return;
}
sliceInfos[index] = mSlices->getCacheFor(bk);
} else {
if (table.tableSize() == 0) {
return;
}
sliceInfosUnsorted[index] = mSlices->getCacheUnsortedFor(bk);
auto binding = o2::soa::getLabelFromTypeForKey<std::decay_t<T>>(mIndexColumnName);
auto bk = std::make_pair(binding, mIndexColumnName);
if constexpr (!o2::soa::is_smallgroups<std::decay_t<T>>) {
if (table.size() == 0) {
return;
}
}
sliceInfos[index] = mSlices->getCacheFor(bk);
} else {
if (table.tableSize() == 0) {
return;
}
sliceInfosUnsorted[index] = mSlices->getCacheUnsortedFor(bk);
}
}

template <typename T>
auto extractingFunction(T&&)
{
}

template <typename T>
requires (soa::is_filtered_table<std::decay_t<T>>)
auto extractingFunction(T&& table)
{
if constexpr (soa::is_filtered_table<std::decay_t<T>>) {
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
selections[index] = &table.getSelectedRows();
starts[index] = selections[index]->begin();
}
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
selections[index] = &table.getSelectedRows();
starts[index] = selections[index]->begin();
}

GroupSlicerIterator(G& gt, std::tuple<A...>& at, ArrowTableSlicingCache& slices)
Expand Down Expand Up @@ -190,16 +198,16 @@ struct GroupSlicer {
{
constexpr auto index = framework::has_type_at_v<A1>(associated_pack_t{});
auto& originalTable = std::get<A1>(*mAt);
if (originalTable.size() == 0) {
return originalTable;
}
uint64_t pos;
if constexpr (soa::is_filtered_table<std::decay_t<G>>) {
pos = groupSelection[position];
} else {
pos = position;
}
// optimized split
if (originalTable.size() == 0) {
return originalTable;
}
auto oc = sliceInfos[index].getSliceFor(pos);
uint64_t offset = oc.first;
auto count = oc.second;
Expand Down Expand Up @@ -229,16 +237,16 @@ struct GroupSlicer {
{
constexpr auto index = framework::has_type_at_v<A1>(associated_pack_t{});
auto& originalTable = std::get<A1>(*mAt);
if (originalTable.size() == 0) {
return originalTable;
}
uint64_t pos;
if constexpr (soa::is_filtered_table<std::decay_t<G>>) {
pos = groupSelection[position];
} else {
pos = position;
}
// optimized split
if (originalTable.size() == 0) {
return originalTable;
}
auto oc = sliceInfos[index].getSliceFor(pos);
uint64_t offset = oc.first;
auto count = oc.second;
Expand Down

0 comments on commit e8ff6cc

Please sign in to comment.