@@ -1512,32 +1512,41 @@ std::array<std::shared_ptr<arrow::Array>, sizeof...(Cs)> getChunks(arrow::Table*
15121512 return std::array<std::shared_ptr<arrow::Array>, sizeof ...(Cs)>{o2::soa::getIndexFromLabel (table, Cs::columnLabel ())->chunk (ci)...};
15131513}
15141514
1515- template <typename C>
1516- typename C::type getSingleRowPersistentData (arrow::Table* table, uint64_t ci, uint64_t ai)
1515+ template <typename T, typename C>
1516+ typename C::type getSingleRowPersistentData (arrow::Table* table, T& rowIterator, uint64_t ci = - 1 , uint64_t ai = - 1 )
15171517{
1518+ if (ci == -1 || ai == -1 ) {
1519+ auto colIterator = static_cast <C>(rowIterator).getIterator ();
1520+ ci = colIterator.mCurrentChunk ;
1521+ ai = *(colIterator.mCurrentPos ) - colIterator.mFirstIndex ;
1522+ }
15181523 return std::static_pointer_cast<o2::soa::arrow_array_for_t <typename C::type>>(o2::soa::getIndexFromLabel (table, C::columnLabel ())->chunk (ci))->raw_values ()[ai];
15191524}
15201525
15211526template <typename T, typename C>
1522- typename C::type getSingleRowDynamicData (T& rowIterator, uint64_t globalIndex)
1527+ typename C::type getSingleRowDynamicData (T& rowIterator, uint64_t globalIndex = - 1 )
15231528{
1524- rowIterator.setCursor (globalIndex);
1529+ if (globalIndex != -1 && globalIndex != *std::get<0 >(rowIterator.getIndices ())) {
1530+ rowIterator.setCursor (globalIndex);
1531+ }
15251532 return rowIterator.template getDynamicColumn <C>();
15261533}
15271534
15281535template <typename T, typename C>
1529- typename C::type getSingleRowIndexData (T& rowIterator, uint64_t globalIndex)
1536+ typename C::type getSingleRowIndexData (T& rowIterator, uint64_t globalIndex = - 1 )
15301537{
1531- rowIterator.setCursor (globalIndex);
1538+ if (globalIndex != -1 && globalIndex != *std::get<0 >(rowIterator.getIndices ())) {
1539+ rowIterator.setCursor (globalIndex);
1540+ }
15321541 return rowIterator.template getId <C>();
15331542}
15341543
15351544template <typename T, typename C>
1536- typename C::type getSingleRowData (arrow::Table* table, T& rowIterator, uint64_t ci, uint64_t ai, uint64_t globalIndex)
1545+ typename C::type getSingleRowData (arrow::Table* table, T& rowIterator, uint64_t ci = - 1 , uint64_t ai = - 1 , uint64_t globalIndex = - 1 )
15371546{
15381547 using decayed = std::decay_t <C>;
15391548 if constexpr (decayed::persistent::value) {
1540- return getSingleRowPersistentData<C>(table, ci, ai);
1549+ return getSingleRowPersistentData<T, C>(table, rowIterator , ci, ai);
15411550 } else if constexpr (o2::soa::is_dynamic_t <decayed>()) {
15421551 return getSingleRowDynamicData<T, C>(rowIterator, globalIndex);
15431552 } else if constexpr (o2::soa::is_index_t <decayed>::value) {
@@ -1548,7 +1557,7 @@ typename C::type getSingleRowData(arrow::Table* table, T& rowIterator, uint64_t
15481557}
15491558
15501559template <typename T, typename ... Cs>
1551- std::tuple<typename Cs::type...> getRowData (arrow::Table* table, T rowIterator, uint64_t ci, uint64_t ai, uint64_t globalIndex)
1560+ std::tuple<typename Cs::type...> getRowData (arrow::Table* table, T rowIterator, uint64_t ci = - 1 , uint64_t ai = - 1 , uint64_t globalIndex = - 1 )
15521561{
15531562 return std::make_tuple (getSingleRowData<T, Cs>(table, rowIterator, ci, ai, globalIndex)...);
15541563}
0 commit comments