[ https://issues.apache.org/jira/browse/AVRO-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17741677#comment-17741677 ]
Ryan Skraba commented on AVRO-3789: ----------------------------------- Hello! I'm adding this to the release notes for 1.11.2, sorry :/ It's not possible to "unpublish" a maven release, but we can do a 1.11.3 really quickly! > Comparing maps in GenericData is wrong for certain combinations and fails for > empty maps > ---------------------------------------------------------------------------------------- > > Key: AVRO-3789 > URL: https://issues.apache.org/jira/browse/AVRO-3789 > Project: Apache Avro > Issue Type: Bug > Components: java > Affects Versions: 1.11.2 > Reporter: Felix Krull > Priority: Major > Labels: pull-request-available > Fix For: 1.11.3 > > Time Spent: 20m > Remaining Estimate: 0h > > The rewritten map comparison implementation in GenericData (AVRO-2943 > according to the commit message) throws a NoSuchElementException when used to > compare empty maps. Partial stacktrace: > {code} > Caused by: java.util.NoSuchElementException > at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1513) > at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1534) > at > org.apache.avro.generic.GenericData.compareMaps(GenericData.java:1163) > at org.apache.avro.generic.GenericData.compare(GenericData.java:1250) > at org.apache.avro.specific.SpecificData.compare(SpecificData.java:476) > at org.apache.avro.generic.GenericData.compare(GenericData.java:1229) > at org.apache.avro.specific.SpecificData.compare(SpecificData.java:476) > at > org.apache.avro.specific.SpecificRecordBase.equals(SpecificRecordBase.java:88) > at scala.runtime.BoxesRunTime.equals2(BoxesRunTime.java:133) > at scala.runtime.BoxesRunTime.equals(BoxesRunTime.java:119) > at > org.scalactic.DefaultEquality$.areEqualComparingArraysStructurally(DefaultEquality.scala:70) > at org.scalactic.DefaultEquality.areEqual(DefaultEquality.scala:37) > at org.mockito.package$$anon$2.areEqual(mockito.scala:614) > at > org.scalactic.TripleEqualsSupport$Equalizer.$eq$eq$eq(TripleEqualsSupport.scala:117) > at org.mockito.matchers.EqTo.matches(EqTo.scala:11) > ... > {code} > > ---- > Also, the check in line 1170 that's intended to shortcircuit for maps of > different sizes is incorrect. Because of this, maps will incorrectly compare > equal when: > * their sizes are different > * one is a superset of the other map -- This message was sent by Atlassian Jira (v8.20.10#820010)