sl255051 commented on code in PR #10678:
URL: https://github.com/apache/iceberg/pull/10678#discussion_r1702992594


##########
api/src/main/java/org/apache/iceberg/types/TypeUtil.java:
##########
@@ -182,11 +181,10 @@ public static Map<Integer, String> indexQuotedNameById(
   }
 
   public static Map<String, Integer> indexByLowerCaseName(Types.StructType 
struct) {
-    Map<String, Integer> indexByLowerCaseName = Maps.newHashMap();
+    ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
     indexByName(struct)
-        .forEach(
-            (name, integer) -> 
indexByLowerCaseName.put(name.toLowerCase(Locale.ROOT), integer));
-    return indexByLowerCaseName;
+        .forEach((name, integer) -> builder.put(name.toLowerCase(Locale.ROOT), 
integer));
+    return builder.buildOrThrow();

Review Comment:
   I'll make the change but it kind of assumes that only two fields will ever 
have conflicting lowercase names. What if the schema contains fields named 
`data`, `DATA` and `Data`?
   
   (I agree having a schema with both `data` and `DATA` would be rare. Having a 
schema with `data`, `DATA` and `Data` would be another order of magnitude rare.)



-- 
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: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to