question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StructLikeWrapper equals method is broken

See original GitHub issue

I 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:

  1. struct<1000: event_time_day: optional date, 1001: level: optional string>
  2. 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:open
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
szehon-hocommented, Jun 21, 2022

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

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found