my doubt is about if custom classes in Flink with Java needs to override or not hashCode()
and equals()
methods because I have read in this page that hashCode()
MUST never be implemented in distributed systems and Apache Flink is one of them.
Example: I have this class:
public class EventCounter {
public String Id;
public long count;
public Timestamp firstEvent;
public Timestamp lastEvent;
public Date date;
public EventCounter() {
}
}
Do I need to implement hashCode()
and equals()
for this kind of classes in Flink or it is better for performance if I let Flink manage those methods on it's own?
Kind regards!
Before writing the two methods, just think about your class need to be,
symmetric
ortransitive
orconsistent
?It specially designed for Hash based algorithms. So you need to make sure that them in proper way, and a side note creating hash code is a CPU intensive task.