StructLikeWrapper equals method is broken
See original GitHub issueI ran into a situation when I had to check if two StructLikeWrapper are equal.
Those were results of some operations on partition schema (details here https://github.com/trinodb/trino/issues/12874)
Their structs fields were different:
struct<1000: event_time_day: optional date, 1001: level: optional string>
struct<1001: level: optional string, 1002: event_time_hour: optional int>
Different types of fields resulted in IllegalArgumentException
thrown from https://github.com/apache/iceberg/blob/a38e66323a99b65f433cb6e96007674a741a2f5a/core/src/main/java/org/apache/iceberg/util/StructLikeWrapper.java#L76
I think it should just return false instead of throwing an exception
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Overriding the java equals() method - not working?
In Java, the equals() method that is inherited from Object is: public boolean equals(Object other);. In other words, the parameter must be ...
Read more >How to Implement Java's equals Method Correctly - SitePoint
It is determined by a class's equals method and there are a couple of things to be considered for a correct implementation.
Read more >StructLikeWrapper equals method is broken - apache/iceberg ...
I ran into a situation when I had to check if two StructLikeWrapper are equal. Those were results of some operations on partition...
Read more >Overriding equals() and hashCode() method in Java and ...
Java recommends to override equals and hashCode method if equality is going ... of hashcode() method, finally results in breaking the contract of...
Read more >How and Why to Override the equals Method in Java
The String class overrides the equals method it inherited from the Object class and implemented logic to compare the two String objects character...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yea the trick is both StructLikeWrapper need the same type to compare. It may be risky to change it at this point?
@findinpath there’s a few prs on master fixing partitions table, not released yet, did you check with those? In particular #4560 and #4516 and #4637 (the first one being perhaps the more pertinent for this issue).
https://github.com/apache/iceberg/pull/5157