Skip to content

Commit e75ff67

Browse files
committed
fixup! update
1 parent 903b1a6 commit e75ff67

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,22 +1540,7 @@ auto doSliceBy(T const* table, o2::framework::PresliceBase<C, Policy, OPT> const
15401540
return doSliceByHelper(table, selection);
15411541
}
15421542

1543-
auto sliceSelection(SelectionVector const& mSelectedRows, int64_t nrows, uint64_t offset);
1544-
1545-
template <soa::is_table T>
1546-
requires(!soa::is_filtered_table<T>)
1547-
auto prepareFilteredSlice(T const* table, std::shared_ptr<arrow::Table> slice, uint64_t offset)
1548-
{
1549-
if (offset >= static_cast<uint64_t>(table->tableSize())) {
1550-
typename T::self_t fresult{{{slice}}, SelectionVector{}, 0};
1551-
table->copyIndexBindings(fresult);
1552-
return fresult;
1553-
}
1554-
auto slicedSelection = sliceSelection(table->getSelectedRows(), slice->num_rows(), offset);
1555-
typename T::self_t fresult{{{slice}}, std::move(slicedSelection), offset};
1556-
table->copyIndexBindings(fresult);
1557-
return fresult;
1558-
}
1543+
SelectionVector sliceSelection(gsl::span<int64_t const> const& mSelectedRows, int64_t nrows, uint64_t offset);
15591544

15601545
template <soa::is_filtered_table T>
15611546
auto prepareFilteredSlice(T const* table, std::shared_ptr<arrow::Table> slice, uint64_t offset)
@@ -1571,7 +1556,7 @@ auto prepareFilteredSlice(T const* table, std::shared_ptr<arrow::Table> slice, u
15711556
return fresult;
15721557
}
15731558

1574-
template <typename T, typename C, bool OPT>
1559+
template <soa::is_filtered_table T, typename C, bool OPT>
15751560
requires(o2::soa::is_binding_compatible_v<C, T>())
15761561
auto doFilteredSliceBy(T const* table, o2::framework::PresliceBase<C, framework::PreslicePolicySorted, OPT> const& container, int value)
15771562
{

Framework/Core/src/ASoA.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ SelectionVector selectionToVector(gandiva::Selection const& sel)
5050
return rows;
5151
}
5252

53+
SelectionVector sliceSelection(gsl::span<int64_t const> const& mSelectedRows, int64_t nrows, uint64_t offset)
54+
{
55+
auto start = offset;
56+
auto end = start + nrows;
57+
auto start_iterator = std::lower_bound(mSelectedRows.begin(), mSelectedRows.end(), start);
58+
auto stop_iterator = std::lower_bound(start_iterator, mSelectedRows.end(), end);
59+
SelectionVector slicedSelection{start_iterator, stop_iterator};
60+
std::transform(slicedSelection.begin(), slicedSelection.end(), slicedSelection.begin(),
61+
[&start](int64_t idx) {
62+
return idx - static_cast<int64_t>(start);
63+
});
64+
return slicedSelection;
65+
}
66+
5367
std::shared_ptr<arrow::Table> ArrowHelpers::joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables)
5468
{
5569
if (tables.size() == 1) {

0 commit comments

Comments
 (0)