You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/06/22 00:51:15 UTC

[GitHub] [iceberg] kbendick commented on a change in pull request #2717: fix inconsistent case type of field name

kbendick commented on a change in pull request #2717:
URL: https://github.com/apache/iceberg/pull/2717#discussion_r655798868



##########
File path: core/src/main/java/org/apache/iceberg/data/GenericRecord.java
##########
@@ -28,16 +28,16 @@
 import org.apache.iceberg.StructLike;
 import org.apache.iceberg.relocated.com.google.common.base.Objects;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
-import org.apache.iceberg.relocated.com.google.common.collect.Maps;
 import org.apache.iceberg.types.Types;
 import org.apache.iceberg.types.Types.StructType;
+import org.apache.iceberg.util.CaseInsensitiveMap;
 
 public class GenericRecord implements Record, StructLike {
   private static final LoadingCache<StructType, Map<String, Integer>> NAME_MAP_CACHE =
       Caffeine.newBuilder()
       .weakKeys()
       .build(struct -> {
-        Map<String, Integer> idToPos = Maps.newHashMap();
+        Map<String, Integer> idToPos = new CaseInsensitiveMap<>();

Review comment:
       There is precedence elsewhere for using the treemap comparator as mentioned by @marton-bod.
   
   The times that we already have `CaseInsensitiveMap` are usually using the `CaseInsensitiveMap` from spark (where it wouldn't make sense to use TreeMap and a Comparator in such a way in Scala).
   
   If we do add a `CaseInsensitiveMap`, could it potentially be made a little simpler, maybe even just a utility that returns the above (though I agree, the above inlined is the canonical java answer, such as when I google it etc... there are some scattered implementations but not in any libraries that we already shade such as guava).




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org