mihaibudiu commented on code in PR #3786: URL: https://github.com/apache/calcite/pull/3786#discussion_r1589514479
########## core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java: ########## @@ -5529,9 +5529,23 @@ public static List mapValues(Map map) { /** Support the MAP_CONTAINS_KEY function. */ public static Boolean mapContainsKey(Map map, Object key) { + for (Object mapKey : map.keySet()) { + if (isNumericEqual(mapKey, key)) { + return true; + } + } return map.containsKey(key); } + private static boolean isNumericEqual(Object obj1, Object obj2) { + if (obj1 instanceof Number && obj2 instanceof Number) { + double num1 = ((Number) obj1).doubleValue(); Review Comment: this may not work for some decimal values which cannot be represented exactly as doubles in general, it is not recommended to compare floating point values for equality, e.g, https://www.jetbrains.com/help/resharper/CompareOfFloatsByEqualityOperator.html -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org