Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Framework/Core/include/Framework/ArrowTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ArrowRange {

bool operator!=(ArrowRange const& other) const
{
return (offset != other.offset) && (size != other.size);
return (offset != other.offset) || (size != other.size);
}
};

Expand Down
19 changes: 14 additions & 5 deletions Framework/Core/src/ASoA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ void canNotJoin(std::vector<std::shared_ptr<arrow::Table>> const& tables, std::s
{
for (auto i = 0U; i < tables.size() - 1; ++i) {
if (tables[i]->num_rows() != tables[i + 1]->num_rows()) {
throw o2::framework::runtime_error_f("Tables %s and %s have different sizes (%d vs %d) and cannot be joined!",
makeString(labels[i]), makeString(labels[i + 1]), tables[i]->num_rows(), tables[i + 1]->num_rows());
throw o2::framework::runtime_error_f("Tables %s and %s have different sizes (%lld vs %lld) and cannot be joined!",
makeString(labels[i]), makeString(labels[i + 1]), (long long)tables[i]->num_rows(), (long long)tables[i + 1]->num_rows());
}
}
}
Expand All @@ -102,11 +102,20 @@ void IncompatibleRanges(std::vector<ArrowTableRef> const& tables, std::span<T> l
if (loc != std::ranges::cend(tables)) {
auto pos = std::distance(tables.begin(), loc);
auto next = loc + 1;
if (loc->range.size != next->range.size) {
if (labels.empty()) {
throw o2::framework::runtime_error_f("Tables at positions %d and %d have different sizes (%lld vs %lld) and cannot be joined!",
(int)pos, (int)pos + 1, (long long)loc->range.size, (long long)next->range.size);
}
throw o2::framework::runtime_error_f("Tables %s and %s have different sizes (%lld vs %lld) and cannot be joined!",
makeString(labels[pos]), makeString(labels[pos + 1]), (long long)loc->range.size, (long long)next->range.size);
}
if (labels.empty()) {
throw o2::framework::runtime_error_f("Incompatible ranges at %d: (%zu, %z) vs. (%zu, %z)", pos, loc->range.offset, loc->range.size, next->range.offset, next->range.size);
} else {
throw o2::framework::runtime_error_f("Incompatible ranges at %d between %s and %s: (%zu, %z) vs. (%zu, %z)", pos, makeString(labels[pos]), makeString(labels[pos + 1]), loc->range.offset, loc->range.size, next->range.offset, next->range.size);
throw o2::framework::runtime_error_f("Incompatible ranges at %d: (%llu, %lld) vs. (%llu, %lld)",
(int)pos, (unsigned long long)loc->range.offset, (long long)loc->range.size, (unsigned long long)next->range.offset, (long long)next->range.size);
}
throw o2::framework::runtime_error_f("Incompatible ranges at %d between %s and %s: (%llu, %lld) vs. (%llu, %lld)",
(int)pos, makeString(labels[pos]), makeString(labels[pos + 1]), (unsigned long long)loc->range.offset, (long long)loc->range.size, (unsigned long long)next->range.offset, (long long)next->range.size);
}
}

Expand Down
19 changes: 14 additions & 5 deletions Framework/Core/test/test_ASoA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,20 @@ TEST_CASE("TestJoinedTables")
REQUIRE(15 == test.x() + test.y() + test.z());
}

try {
auto testF = join(TestZ{tableZ}, TestW{tableW});
} catch (RuntimeErrorRef ref) {
REQUIRE(std::string{error_from_ref(ref).what} == "Tables TEST and TEST have different sizes (8 vs 3) and cannot be joined!");
}
// a table of different size must be detected in any position of the join
auto joinError = [](auto&& makeJoin) -> std::string {
try {
makeJoin();
} catch (RuntimeErrorRef ref) {
return error_from_ref(ref).what;
}
return "";
};
REQUIRE(joinError([&] { join(TestZ{tableZ}, TestW{tableW}); }) == "Tables TEST and TEST have different sizes (8 vs 3) and cannot be joined!");
REQUIRE(joinError([&] { join(TestW{tableW}, TestY{tableY}, TestZ{tableZ}); }) == "Tables TEST and TEST have different sizes (3 vs 8) and cannot be joined!");
REQUIRE(joinError([&] { join(TestX{tableX}, TestW{tableW}, TestZ{tableZ}); }) == "Tables TEST and TEST have different sizes (8 vs 3) and cannot be joined!");
REQUIRE(joinError([&] { join(TestX{tableX}, TestY{tableY}, TestW{tableW}); }) == "Tables TEST and TEST have different sizes (8 vs 3) and cannot be joined!");
REQUIRE(joinError([&] { Join<TestX, TestY, TestW>{{tableX, tableY, tableW}}; }) == "Tables at positions 1 and 2 have different sizes (8 vs 3) and cannot be joined!");
}

TEST_CASE("TestConcatTables")
Expand Down
Loading