vthemelis commented on issue #44575:
URL: https://github.com/apache/arrow/issues/44575#issuecomment-2457432398

   > The use of `StringComparer.CurrentCulture` is definitely a head-scratcher. 
It apparently dates back to the very first checkin of the file. It's especially 
surprising because the very same checkin used 
`StringComparer.OrdinalIgnoreCase` to build the dictionary. While I ordinarily 
argue against making breaking changes, I think it might be justified this time.
   > 
   > I would expect the allocation to be a result of the closure that needs to 
be created to pass to `First`.
   
   It seems like there are four methods that try to retrieve individual fields 
from the schema (excluding puplic lookups):
   ```csharp
   public class Schema
   {
   ...
           public Field GetFieldByIndex(int i) => _fieldsList[I];
           public Field GetFieldByName(string name) => 
FieldsLookup[name].FirstOrDefault();
           public int GetFieldIndex(string name, StringComparer comparer)
           {
               IEqualityComparer<string> equalityComparer = 
(IEqualityComparer<string>)comparer;
               return GetFieldIndex(name, equalityComparer);
           }
   
           public int GetFieldIndex(string name, IEqualityComparer<string> 
comparer = default) {...}
   }
   ```
   
   The first two will use the default string comparator and the next two will 
use the culture-aware one. This is inconsistent and confusing so it might be 
worth aligning the two sides.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to