Skip to content

Commit 066edd8

Browse files
committed
cover more cases
1 parent 6e8bcc6 commit 066edd8

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

Framework/Core/include/Framework/ASoA.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,12 @@ struct TableIterator : IP, C... {
12481248
};
12491249

12501250
struct ArrowHelpers {
1251+
static o2::soa::ArrowTableRef joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
12511252
static o2::soa::ArrowTableRef joinTables(std::vector<o2::soa::ArrowTableRef>&& tables);
12521253
static o2::soa::ArrowTableRef joinTables(std::vector<o2::soa::ArrowTableRef>&& tables, std::span<const char* const> labels);
12531254
static o2::soa::ArrowTableRef joinTables(std::vector<o2::soa::ArrowTableRef>&& tables, std::span<const std::string> labels);
12541255
static o2::soa::ArrowTableRef concatTables(std::vector<o2::soa::ArrowTableRef>&& tables);
1256+
static o2::soa::ArrowTableRef concatTables(std::vector<std::shared_ptr<arrow::Table>>&& tables);
12551257
};
12561258

12571259
template <size_t N1, std::array<TableRef, N1> os1, size_t N2, std::array<TableRef, N2> os2>
@@ -1962,27 +1964,32 @@ class Table
19621964
}
19631965
}
19641966

1965-
Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, ArrowRange range)
1967+
Table(std::shared_ptr<arrow::Table> table)
1968+
: Table(o2::soa::ArrowTableRef{table})
1969+
{
1970+
}
1971+
1972+
Table(std::vector<o2::soa::ArrowTableRef>&& tables)
19661973
requires(ref.origin_hash != "CONC"_h)
1967-
: Table({ArrowHelpers::joinTables(std::move(tables), std::span{originalLabels}), range})
1974+
: Table(ArrowHelpers::joinTables(std::forward<std::vector<o2::soa::ArrowTableRef>>(tables), std::span{originalLabels}))
19681975
{
19691976
}
19701977

1971-
Table(std::vector<std::shared_ptr<arrow::Table>>&& tables, ArrowRange range)
1978+
Table(std::vector<o2::soa::ArrowTableRef>&& tables)
19721979
requires(ref.origin_hash == "CONC"_h)
1973-
: Table({ArrowHelpers::concatTables(std::move(tables)), range})
1980+
: Table(ArrowHelpers::concatTables(std::forward<std::vector<o2::soa::ArrowTableRef>>(tables)))
19741981
{
19751982
}
19761983

1977-
Table(std::vector<o2::soa::ArrowTableRef>&& tables)
1984+
Table(std::vector<std::shared_ptr<arrow::Table>>&& tables)
19781985
requires(ref.origin_hash != "CONC"_h)
1979-
: Table(ArrowHelpers::joinTables(std::move(tables), std::span{originalLabels}))
1986+
: Table(ArrowHelpers::joinTables(std::forward<std::vector<std::shared_ptr<arrow::Table>>>(tables)))
19801987
{
19811988
}
19821989

1983-
Table(std::vector<o2::soa::ArrowTableRef>&& tables)
1990+
Table(std::vector<std::shared_ptr<arrow::Table>>&& tables)
19841991
requires(ref.origin_hash == "CONC"_h)
1985-
: Table(ArrowHelpers::concatTables(std::move(tables)))
1992+
: Table(ArrowHelpers::concatTables(std::forward<std::vector<std::shared_ptr<arrow::Table>>>(tables)))
19861993
{
19871994
}
19881995

Framework/Core/src/ASoA.cxx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ std::shared_ptr<arrow::Table> joinTablesImpl(std::ranges::input_range auto table
126126
}
127127

128128
template <typename T>
129-
ArrowTableRef joinTablesImpl(std::ranges::input_range auto tables, std::span<T> labels)
129+
ArrowTableRef joinTablesImpl(std::ranges::input_range auto tables, std::span<T> labels)
130130
{
131131
if (tables.size() == 1) {
132132
return tables.front();
@@ -137,6 +137,13 @@ template <typename T>
137137
}
138138
} // namespace
139139

140+
o2::soa::ArrowTableRef ArrowHelpers::joinTables(std::vector<std::shared_ptr<arrow::Table>>&& tables)
141+
{
142+
std::vector<ArrowTableRef> refs;
143+
std::ranges::transform(tables, std::back_inserter(refs),[](auto const& table){ return ArrowTableRef{table}; });
144+
return joinTablesImpl(refs, std::span<const char* const>());
145+
}
146+
140147
o2::soa::ArrowTableRef ArrowHelpers::joinTables(std::vector<o2::soa::ArrowTableRef>&& tables)
141148
{
142149
return joinTablesImpl(tables, std::span<const char* const>());
@@ -187,6 +194,13 @@ o2::soa::ArrowTableRef ArrowHelpers::concatTables(std::vector<o2::soa::ArrowTabl
187194
return {arrow::Table::Make(std::make_shared<arrow::Schema>(resultFields), columns)};
188195
}
189196

197+
o2::soa::ArrowTableRef ArrowHelpers::concatTables(std::vector<std::shared_ptr<arrow::Table>>&& tables)
198+
{
199+
std::vector<ArrowTableRef> refs;
200+
std::ranges::transform(tables, std::back_inserter(refs),[](auto const& table){ return ArrowTableRef{table}; });
201+
return concatTables(std::move(refs));
202+
}
203+
190204
// ASCII-only lowercase. Column labels are plain identifiers, so we deliberately
191205
// avoid the locale-aware std::tolower: it goes through the C locale facet on
192206
// every character and dominated getIndexFromLabel in profiles.

0 commit comments

Comments
 (0)