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
12 changes: 10 additions & 2 deletions Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,15 @@ static constexpr std::string getLabelFromType()
template <typename... C>
static constexpr auto hasColumnForKey(framework::pack<C...>, std::string const& key)
{
return ((C::inherited_t::mLabel == key) || ...);
auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string& str2) {
return std::ranges::equal(
str1, str2,
[](char c1, char c2) {
return std::tolower(static_cast<unsigned char>(c1)) ==
std::tolower(static_cast<unsigned char>(c2));
});
};
return (caseInsensitiveCompare(C::inherited_t::mLabel, key) || ...);
}

template <TableRef ref>
Expand Down Expand Up @@ -2866,7 +2874,7 @@ consteval auto getIndexTargets()
o2::soa::Binding getCurrentRaw() const { return mBinding; } \
o2::soa::Binding mBinding; \
}; \
[[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" #_Table_ _Suffix_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
[[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_ _Suffix_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }

#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
Expand Down
24 changes: 21 additions & 3 deletions Framework/Core/src/ArrowTableSlicingCache.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@
namespace o2::framework
{

namespace
{
std::shared_ptr<arrow::ChunkedArray> GetColumnByNameCI(std::shared_ptr<arrow::Table> const& table, std::string const& key)
{
auto const& fields = table->schema()->fields();
auto target = std::find_if(fields.begin(), fields.end(), [&key](std::shared_ptr<arrow::Field> const& field) {
return [](std::string_view const& s1, std::string_view const& s2) {
return std::ranges::equal(
s1, s2,
[](char c1, char c2) {
return std::tolower(static_cast<unsigned char>(c1)) == std::tolower(static_cast<unsigned char>(c2));
});
}(field->name(), key);
});
return table->column(std::distance(fields.begin(), target));
}
} // namespace

void updatePairList(Cache& list, std::string const& binding, std::string const& key, bool enabled = true)
{
auto locate = std::find_if(list.begin(), list.end(), [&binding, &key](auto const& entry) { return (entry.binding == binding) && (entry.key == key); });
Expand Down Expand Up @@ -99,7 +117,7 @@ arrow::Status ArrowTableSlicingCache::updateCacheEntry(int pos, std::shared_ptr<
validateOrder(bindingsKeys[pos], table);

int maxValue = -1;
auto column = table->GetColumnByName(k);
auto column = GetColumnByNameCI(table, k);

// starting from the end, find the first positive value, in a sorted column it is the largest index
for (auto iChunk = column->num_chunks() - 1; iChunk >= 0; --iChunk) {
Expand Down Expand Up @@ -155,7 +173,7 @@ arrow::Status ArrowTableSlicingCache::updateCacheEntryUnsorted(int pos, const st
if (!e) {
throw runtime_error_f("Disabled unsorted cache %s/%s update requested", b.c_str(), k.c_str());
}
auto column = table->GetColumnByName(k);
auto column = GetColumnByNameCI(table, k);
auto row = 0;
for (auto iChunk = 0; iChunk < column->num_chunks(); ++iChunk) {
auto chunk = static_cast<arrow::NumericArray<arrow::Int32Type>>(column->chunk(iChunk)->data());
Expand Down Expand Up @@ -252,7 +270,7 @@ SliceInfoUnsortedPtr ArrowTableSlicingCache::getCacheUnsortedForPos(int pos) con
void ArrowTableSlicingCache::validateOrder(Entry const& bindingKey, const std::shared_ptr<arrow::Table>& input)
{
auto const& [target, key, enabled] = bindingKey;
auto column = input->GetColumnByName(key);
auto column = o2::framework::GetColumnByNameCI(input, key);
auto array0 = static_cast<arrow::NumericArray<arrow::Int32Type>>(column->chunk(0)->data());
int32_t prev = 0;
int32_t cur = array0.Value(0);
Expand Down