@@ -282,7 +282,8 @@ struct AnalysisDataProcessorBuilder {
282282 x.asArrowTable (),
283283 static_cast <int32_t >(gt.tableSize ()),
284284 &groups[index],
285- &offsets[index]);
285+ &offsets[index],
286+ &sizes[index]);
286287 if (result.ok () == false ) {
287288 throw runtime_error (" Cannot split collection" );
288289 }
@@ -394,7 +395,7 @@ struct AnalysisDataProcessorBuilder {
394395
395396 // for each grouping element we need to slice the selection vector
396397 auto start_iterator = std::lower_bound (starts[index], selections[index]->end (), (offsets[index])[pos]);
397- auto stop_iterator = std::lower_bound (start_iterator, selections[index]->end (), (offsets[index])[pos + 1 ]);
398+ auto stop_iterator = std::lower_bound (start_iterator, selections[index]->end (), (offsets[index])[pos] + (sizes[index])[pos ]);
398399 starts[index] = stop_iterator;
399400 soa::SelectionVector slicedSelection{start_iterator, stop_iterator};
400401 std::transform (slicedSelection.begin (), slicedSelection.end (), slicedSelection.begin (),
@@ -421,6 +422,7 @@ struct AnalysisDataProcessorBuilder {
421422 soa::SelectionVector const * groupSelection = nullptr ;
422423 std::array<std::vector<arrow::Datum>, sizeof ...(A)> groups;
423424 std::array<std::vector<uint64_t >, sizeof ...(A)> offsets;
425+ std::array<std::vector<int >, sizeof ...(A)> sizes;
424426 std::array<soa::SelectionVector const *, sizeof ...(A)> selections;
425427 std::array<soa::SelectionVector::const_iterator, sizeof ...(A)> starts;
426428 };
0 commit comments