Skip to content

Commit ee233ec

Browse files
aalkinktf
authored andcommitted
DPL Analysis: add table name to spawner errors
1 parent 2b63cfa commit ee233ec

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Framework/Core/include/Framework/TableBuilder.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ auto makeEmptyTable()
770770

771771
/// Expression-based column generator to materialize columns
772772
template <typename... C>
773-
auto spawner(framework::pack<C...> columns, arrow::Table* atable)
773+
auto spawner(framework::pack<C...> columns, arrow::Table* atable, const char* name)
774774
{
775775
static auto new_schema = o2::soa::createSchemaFromColumns(columns);
776776
static auto projectors = framework::expressions::createProjectors(columns, atable->schema());
@@ -788,15 +788,20 @@ auto spawner(framework::pack<C...> columns, arrow::Table* atable)
788788
while (true) {
789789
auto s = reader.ReadNext(&batch);
790790
if (!s.ok()) {
791-
throw runtime_error_f("Cannot read batches from table: %s", s.ToString().c_str());
791+
throw runtime_error_f("Cannot read batches from table %s: %s", name, s.ToString().c_str());
792792
}
793793
if (batch == nullptr) {
794794
break;
795795
}
796-
s = projectors->Evaluate(*batch, arrow::default_memory_pool(), &v);
797-
if (!s.ok()) {
798-
throw runtime_error_f("Cannot apply projector: %s", s.ToString().c_str());
796+
try {
797+
s = projectors->Evaluate(*batch, arrow::default_memory_pool(), &v);
798+
if (!s.ok()) {
799+
throw runtime_error_f("Cannot apply projector to table %s: %s", name, s.ToString().c_str());
800+
}
801+
} catch (std::exception& e) {
802+
throw runtime_error_f("Cannot apply projector to table %s: exception caught: %s", name, e.what());
799803
}
804+
800805
for (auto i = 0u; i < sizeof...(C); ++i) {
801806
chunks[i].emplace_back(v.at(i));
802807
}

Framework/Core/src/AODReaderHelpers.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ AlgorithmSpec AODReaderHelpers::aodSpawnerCallback(std::vector<InputSpec> reques
167167
using metadata_t = decltype(metadata);
168168
using expressions = typename metadata_t::expression_pack_t;
169169
auto original_table = pc.inputs().get<TableConsumer>(input.binding)->asArrowTable();
170-
return o2::framework::spawner(expressions{}, original_table.get());
170+
return o2::framework::spawner(expressions{}, original_table.get(), input.binding.c_str());
171171
};
172172

173173
if (description == header::DataDescription{"TRACK"}) {

0 commit comments

Comments
 (0)