Skip to content

Commit 217b3a5

Browse files
committed
DPL Analysis: allow binding all the columns which refer to a different table
1 parent b5bbd3a commit 217b3a5

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,16 +804,27 @@ class Table
804804
return unfiltered_const_iterator{mEnd};
805805
}
806806

807+
/// Return a type erased arrow table backing store for / the type safe table.
807808
std::shared_ptr<arrow::Table> asArrowTable() const
808809
{
809810
return mTable;
810811
}
811812

813+
/// Size of the table, in rows.
812814
int64_t size() const
813815
{
814816
return mTable->num_rows();
815817
}
816818

819+
/// Bind the columns which refer to other tables
820+
/// to the associated tables.
821+
template <typename... TA>
822+
void bindExternalIndices(TA*... current)
823+
{
824+
mBegin.bindExternalIndices(current...);
825+
mEnd.bindExternalIndices(current...);
826+
}
827+
817828
private:
818829
template <typename T>
819830
arrow::Column* lookupColumn()
@@ -1098,6 +1109,13 @@ struct Join : JoinBase<Ts...> {
10981109
}
10991110

11001111
using originals = framework::concatenated_pack_t<originals_pack_t<Ts>...>;
1112+
1113+
template <typename... TA>
1114+
void bindExternalIndices(TA*... externals)
1115+
{
1116+
this->bindExternalIndices(externals...);
1117+
}
1118+
11011119
using table_t = JoinBase<Ts...>;
11021120
};
11031121

@@ -1109,6 +1127,13 @@ struct Concat : ConcatBase<T1, T2> {
11091127
: ConcatBase<T1, T2>{ArrowHelpers::concatTables(std::move(tables)), offset} {}
11101128

11111129
using originals = framework::concatenated_pack_t<originals_pack_t<T1>, originals_pack_t<T2>>;
1130+
1131+
template <typename... TA>
1132+
void bindExternalIndices(TA*... externals)
1133+
{
1134+
this->bindExternalIndices(externals...);
1135+
}
1136+
11121137
// FIXME: can be remove when we do the same treatment we did for Join to Concatenate
11131138
using left_t = T1;
11141139
using right_t = T2;

Framework/Core/test/test_ASoA.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ BOOST_AUTO_TEST_CASE(TestDereference)
456456
auto infoWriter = builderA2.cursor<Infos>();
457457
infoWriter(0, 0);
458458
infoWriter(0, 1);
459-
infoWriter(0, 2);
459+
infoWriter(0, 4);
460460
auto infosT = builderA2.finalize();
461461
Infos infos{infosT};
462462
BOOST_REQUIRE_EQUAL(infosT->num_rows(), 3);
@@ -475,9 +475,18 @@ BOOST_AUTO_TEST_CASE(TestDereference)
475475
using namespace o2::framework;
476476
i.bindExternalIndices(&points, &infos);
477477
BOOST_CHECK_EQUAL(i.n(), 10);
478-
BOOST_CHECK_EQUAL(i.info().color(), 2);
478+
BOOST_CHECK_EQUAL(i.info().color(), 4);
479479
BOOST_CHECK_EQUAL(i.pointA().x(), 0);
480480
BOOST_CHECK_EQUAL(i.pointA().y(), 0);
481481
BOOST_CHECK_EQUAL(i.pointB().x(), 3);
482482
BOOST_CHECK_EQUAL(i.pointB().y(), 4);
483+
484+
segments.bindExternalIndices(&points, &infos);
485+
auto j = segments.begin();
486+
BOOST_CHECK_EQUAL(j.n(), 10);
487+
BOOST_CHECK_EQUAL(j.info().color(), 4);
488+
BOOST_CHECK_EQUAL(j.pointA().x(), 0);
489+
BOOST_CHECK_EQUAL(j.pointA().y(), 0);
490+
BOOST_CHECK_EQUAL(j.pointB().x(), 3);
491+
BOOST_CHECK_EQUAL(j.pointB().y(), 4);
483492
}

0 commit comments

Comments
 (0)