1414#include " IndexJSONHelpers.h"
1515
1616namespace o2 ::soa {
17- std::vector<framework::IndexColumnBuilderNG > IndexBuilder::makeBuilders (std::vector<std::shared_ptr<arrow::Table>>&& tables, std::vector<soa::IndexRecord> const & records)
17+ std::vector<framework::IndexColumnBuilder > IndexBuilder::makeBuilders (std::vector<std::shared_ptr<arrow::Table>>&& tables, std::vector<soa::IndexRecord> const & records)
1818{
19- std::vector<framework::IndexColumnBuilderNG> builders;
19+ std::vector<framework::IndexColumnBuilder> builders;
20+ builders.reserve (records.size ());
2021 auto pool = arrow::default_memory_pool ();
2122 builders.emplace_back (IndexKind::IdxSelf, records[0 ].pos , pool);
2223 if (records[0 ].pos >= 0 ) {
@@ -30,7 +31,7 @@ std::vector<framework::IndexColumnBuilderNG> IndexBuilder::makeBuilders(std::vec
3031 return builders;
3132}
3233
33- void IndexBuilder::resetBuilders (std::vector<framework::IndexColumnBuilderNG >& builders, std::vector<std::shared_ptr<arrow::Table>>&& tables)
34+ void IndexBuilder::resetBuilders (std::vector<framework::IndexColumnBuilder >& builders, std::vector<std::shared_ptr<arrow::Table>>&& tables)
3435{
3536 for (auto i = 0U ; i < builders.size (); ++i) {
3637 builders[i].reset (builders[i].mColumnPos >= 0 ? tables[i]->column (builders[i].mColumnPos ) : nullptr );
@@ -41,7 +42,7 @@ void IndexBuilder::resetBuilders(std::vector<framework::IndexColumnBuilderNG>& b
4142 }
4243}
4344
44- std::shared_ptr<arrow::Table> IndexBuilder::materializeNG (std::vector<framework::IndexColumnBuilderNG >& builders, std::vector<std::shared_ptr<arrow::Table>>&& tables, std::vector<soa::IndexRecord> const & records, std::shared_ptr<arrow::Schema> const & schema, bool exclusive)
45+ std::shared_ptr<arrow::Table> IndexBuilder::materialize (std::vector<framework::IndexColumnBuilder >& builders, std::vector<std::shared_ptr<arrow::Table>>&& tables, std::vector<soa::IndexRecord> const & records, std::shared_ptr<arrow::Schema> const & schema, bool exclusive)
4546{
4647 auto size = tables[0 ]->num_rows ();
4748 if (builders.empty ()) {
@@ -77,7 +78,7 @@ std::shared_ptr<arrow::Table> IndexBuilder::materializeNG(std::vector<framework:
7778 }
7879 }
7980
80- std::vector<std::shared_ptr<arrow::ChunkedArray>> arrays; // same
81+ std::vector<std::shared_ptr<arrow::ChunkedArray>> arrays;
8182 arrays.reserve (builders.size ());
8283 for (auto & builder : builders) {
8384 arrays.push_back (builder.result ());
@@ -206,11 +207,12 @@ std::shared_ptr<arrow::Table> Spawner::materialize(ProcessingContext& pc) const
206207std::shared_ptr<arrow::Table> Builder::materialize (ProcessingContext& pc)
207208{
208209 if (builders == nullptr ) {
209- builders = std::make_shared<std::vector<framework::IndexColumnBuilderNG>>();
210+ builders = std::make_shared<std::vector<framework::IndexColumnBuilder>>();
211+ builders->reserve (records.size ());
210212 }
211213 std::shared_ptr<arrow::Table> result;
212214 auto tables = extractSources (pc, labels);
213- result = o2::soa::IndexBuilder::materializeNG (*builders.get (), std::move (tables), records, outputSchema, exclusive);
215+ result = o2::soa::IndexBuilder::materialize (*builders.get (), std::move (tables), records, outputSchema, exclusive);
214216 return result;
215217}
216218} // namespace o2::framework
0 commit comments