diff --git a/Framework/Core/include/Framework/ASoA.h b/Framework/Core/include/Framework/ASoA.h index c459820f56d36..5c877a0e8f476 100644 --- a/Framework/Core/include/Framework/ASoA.h +++ b/Framework/Core/include/Framework/ASoA.h @@ -2954,10 +2954,10 @@ class FilteredBase : public T auto rawSlice(uint64_t start, uint64_t end) const { - auto s = this->asArrowTable()->Slice(start, end - start + 1); - SelectionVector newSelection{static_cast(end - start + 1)}; - std::iota(newSelection.begin(), newSelection.end(), 0); - return self_t{{s}, newSelection, start}; + SelectionVector newSelection; + newSelection.resize(static_cast(end - start + 1)); + std::iota(newSelection.begin(), newSelection.end(), start); + return self_t{{this->asArrowTable()}, std::move(newSelection), 0}; } auto emptySlice() const @@ -3227,12 +3227,14 @@ class Filtered : public FilteredBase return it; } + using FilteredBase::getSelectedRows; + auto rawSlice(uint64_t start, uint64_t end) const { - auto s = this->asArrowTable()->Slice(start, end - start + 1); - SelectionVector newSelection{static_cast(end - start + 1)}; - std::iota(newSelection.begin(), newSelection.end(), 0); - return self_t{{s}, newSelection, start}; + SelectionVector newSelection; + newSelection.resize(static_cast(end - start + 1)); + std::iota(newSelection.begin(), newSelection.end(), start); + return self_t{{this->asArrowTable()}, std::move(newSelection), 0}; } auto emptySlice() const @@ -3401,10 +3403,10 @@ class Filtered> : public FilteredBase auto rawSlice(uint64_t start, uint64_t end) const { - auto s = this->asArrowTable()->Slice(start, end - start + 1); - SelectionVector newSelection{static_cast(end - start + 1)}; - std::iota(newSelection.begin(), newSelection.end(), 0); - return self_t{{s}, newSelection, start}; + SelectionVector newSelection; + newSelection.resize(static_cast(end - start + 1)); + std::iota(newSelection.begin(), newSelection.end(), start); + return self_t{{this->asArrowTable()}, std::move(newSelection), 0}; } auto emptySlice() const diff --git a/Framework/Core/test/test_ASoA.cxx b/Framework/Core/test/test_ASoA.cxx index b97c359c6a739..d38c8183dc459 100644 --- a/Framework/Core/test/test_ASoA.cxx +++ b/Framework/Core/test/test_ASoA.cxx @@ -1039,20 +1039,16 @@ TEST_CASE("TestSelfIndexRecursion") // FIXME: only 4 levels of recursive self-index dereference are tested // self-index binding should stay the same for recursive dereferences for (auto& p : fp) { - auto bp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bp); + REQUIRE(std::is_same_v, FullPoints::iterator>); auto ops = p.pointSeq_as(); for (auto& pp : ops) { - auto bpp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bpp); + REQUIRE(std::is_same_v, FullPoints::iterator>); auto opps = pp.pointSeq_as(); for (auto& ppp : opps) { - auto bppp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bppp); + REQUIRE(std::is_same_v, FullPoints::iterator>); auto oppps = ppp.pointSeq_as(); for (auto& pppp : oppps) { - auto bpppp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bpppp); + REQUIRE(std::is_same_v, FullPoints::iterator>); auto opppps = pppp.pointSeq_as(); } } @@ -1077,21 +1073,16 @@ TEST_CASE("TestSelfIndexRecursion") // Filter should not interfere with self-index and the binding should stay the same for (auto& p : ffp) { - using T1 = std::decay_t; - auto bp = std::is_same_v; - REQUIRE(bp); - auto ops = p.pointSeq_as(); + REQUIRE(std::is_same_v, FilteredPoints::iterator>); + auto ops = p.pointSeq_as::parent_t>(); for (auto& pp : ops) { - auto bpp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bpp); + REQUIRE(std::is_same_v::parent_t, FilteredPoints>); auto opps = pp.pointSeq_as(); for (auto& ppp : opps) { - auto bppp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bppp); + REQUIRE(std::is_same_v, FilteredPoints::iterator>); auto oppps = ppp.pointSeq_as(); for (auto& pppp : oppps) { - auto bpppp = std::is_same_v, FullPoints::iterator>; - REQUIRE(bpppp); + REQUIRE(std::is_same_v, FilteredPoints::iterator>); auto opppps = pppp.pointSeq_as(); } } @@ -1100,7 +1091,7 @@ TEST_CASE("TestSelfIndexRecursion") auto const& ffpa = ffp; - // rawIteratorAt() should create an unfiltered iterator, unline begin() and iteratorAt() + // rawIteratorAt() should create an unfiltered iterator, unlike begin() and iteratorAt() for (auto& it1 : ffpa) { [[maybe_unused]] auto it2 = ffpa.rawIteratorAt(0); [[maybe_unused]] auto it3 = ffpa.iteratorAt(0);