Skip to content

Commit e8ff6cc

Browse files
committed
split splitting and extracting functions
1 parent 2784cc1 commit e8ff6cc

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

Framework/Core/include/Framework/GroupSlicer.h

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,42 @@ struct GroupSlicer {
4545
GroupSlicerIterator& operator=(GroupSlicerIterator&&) = default;
4646

4747
template <typename T>
48+
auto splittingFunction(T&&)
49+
{
50+
}
51+
52+
template <typename T>
53+
requires (o2::soa::relatedByIndex<std::decay_t<G>, std::decay_t<T>>())
4854
auto splittingFunction(T&& table)
4955
{
5056
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
51-
if constexpr (o2::soa::relatedByIndex<std::decay_t<G>, std::decay_t<T>>()) {
52-
auto binding = o2::soa::getLabelFromTypeForKey<std::decay_t<T>>(mIndexColumnName);
53-
auto bk = std::make_pair(binding, mIndexColumnName);
54-
if constexpr (!o2::soa::is_smallgroups<std::decay_t<T>>) {
55-
if (table.size() == 0) {
56-
return;
57-
}
58-
sliceInfos[index] = mSlices->getCacheFor(bk);
59-
} else {
60-
if (table.tableSize() == 0) {
61-
return;
62-
}
63-
sliceInfosUnsorted[index] = mSlices->getCacheUnsortedFor(bk);
57+
auto binding = o2::soa::getLabelFromTypeForKey<std::decay_t<T>>(mIndexColumnName);
58+
auto bk = std::make_pair(binding, mIndexColumnName);
59+
if constexpr (!o2::soa::is_smallgroups<std::decay_t<T>>) {
60+
if (table.size() == 0) {
61+
return;
6462
}
65-
}
63+
sliceInfos[index] = mSlices->getCacheFor(bk);
64+
} else {
65+
if (table.tableSize() == 0) {
66+
return;
67+
}
68+
sliceInfosUnsorted[index] = mSlices->getCacheUnsortedFor(bk);
69+
}
70+
}
71+
72+
template <typename T>
73+
auto extractingFunction(T&&)
74+
{
6675
}
6776

6877
template <typename T>
78+
requires (soa::is_filtered_table<std::decay_t<T>>)
6979
auto extractingFunction(T&& table)
7080
{
71-
if constexpr (soa::is_filtered_table<std::decay_t<T>>) {
72-
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
73-
selections[index] = &table.getSelectedRows();
74-
starts[index] = selections[index]->begin();
75-
}
81+
constexpr auto index = framework::has_type_at_v<std::decay_t<T>>(associated_pack_t{});
82+
selections[index] = &table.getSelectedRows();
83+
starts[index] = selections[index]->begin();
7684
}
7785

7886
GroupSlicerIterator(G& gt, std::tuple<A...>& at, ArrowTableSlicingCache& slices)
@@ -190,16 +198,16 @@ struct GroupSlicer {
190198
{
191199
constexpr auto index = framework::has_type_at_v<A1>(associated_pack_t{});
192200
auto& originalTable = std::get<A1>(*mAt);
201+
if (originalTable.size() == 0) {
202+
return originalTable;
203+
}
193204
uint64_t pos;
194205
if constexpr (soa::is_filtered_table<std::decay_t<G>>) {
195206
pos = groupSelection[position];
196207
} else {
197208
pos = position;
198209
}
199210
// optimized split
200-
if (originalTable.size() == 0) {
201-
return originalTable;
202-
}
203211
auto oc = sliceInfos[index].getSliceFor(pos);
204212
uint64_t offset = oc.first;
205213
auto count = oc.second;
@@ -229,16 +237,16 @@ struct GroupSlicer {
229237
{
230238
constexpr auto index = framework::has_type_at_v<A1>(associated_pack_t{});
231239
auto& originalTable = std::get<A1>(*mAt);
240+
if (originalTable.size() == 0) {
241+
return originalTable;
242+
}
232243
uint64_t pos;
233244
if constexpr (soa::is_filtered_table<std::decay_t<G>>) {
234245
pos = groupSelection[position];
235246
} else {
236247
pos = position;
237248
}
238249
// optimized split
239-
if (originalTable.size() == 0) {
240-
return originalTable;
241-
}
242250
auto oc = sliceInfos[index].getSliceFor(pos);
243251
uint64_t offset = oc.first;
244252
auto count = oc.second;

0 commit comments

Comments
 (0)