File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1626,7 +1626,7 @@ auto select(T const& t, framework::expressions::Filter const& f)
16261626 return Filtered<T>({t.asArrowTable()}, selectionToVector(framework::expressions::createSelection(t.asArrowTable(), f)));
16271627}
16281628
1629- arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, const char* label);
1629+ arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, std::string_view label);
16301630
16311631template <typename D, typename O, typename IP, typename... C>
16321632consteval auto base_iter(framework::pack<C...>&&) -> TableIterator<D, O, IP, C...>
Original file line number Diff line number Diff line change @@ -123,10 +123,19 @@ std::shared_ptr<arrow::Table> ArrowHelpers::concatTables(std::vector<std::shared
123123 return result;
124124}
125125
126- arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, const char* label)
126+ arrow::ChunkedArray* getIndexFromLabel(arrow::Table* table, std::string_view label)
127127{
128128 auto field = std::find_if(table->schema()->fields().begin(), table->schema()->fields().end(), [&](std::shared_ptr<arrow::Field> const& f) {
129- return o2::framework::strToUpper(label) == o2::framework::strToUpper(std::string{f->name()});
129+ auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string& str2) {
130+ return std::ranges::equal(
131+ str1, str2,
132+ [](char c1, char c2) {
133+ return std::tolower(static_cast<unsigned char>(c1)) ==
134+ std::tolower(static_cast<unsigned char>(c2));
135+ });
136+ };
137+
138+ return caseInsensitiveCompare(label, f->name());
130139 });
131140 if (field == table->schema()->fields().end()) {
132141 o2::framework::throw_error(o2::framework::runtime_error_f("Unable to find column with label %s", label));
You can’t perform that action at this time.
0 commit comments