Hi,
your hash code and equals seems correct. Can you post a minimum stream
pipeline reproducer using this class?

FG

On Tue, Feb 1, 2022 at 8:39 PM John Smith <java.dev....@gmail.com> wrote:

> Hi, getting java.lang.IllegalArgumentException: Key group 39 is not in
> KeyGroupRange{startKeyGroup=96, endKeyGroup=103}. Unless you're directly
> using low level state access APIs, this is most likely caused by
> non-deterministic shuffle key (hashCode and equals implementation).
>
> This is my class, is my hashCode deterministic?
>
> public final class MyEventCountKey {
>     private final String countDateTime;
>     private final String domain;
>     private final String event;
>
>     public MyEventCountKey(final String countDateTime, final String domain, 
> final String event) {
>         this.countDateTime = countDateTime;
>         this.domain = domain;
>         this.event = event;
>     }
>
>     public String getCountDateTime() {
>         return countDateTime;
>     }
>
>     public String getDomain() {
>         return domain;
>     }
>
>     public String getEven() {
>         return event;
>     }
>
>     @Override
>     public String toString() {
>         return countDateTime + "|" + domain + "|" + event;
>     }
>
>     @Override
>     public boolean equals(Object o) {
>         if (this == o) return true;
>         if (o == null || getClass() != o.getClass()) return false;
>         MyEventCountKey that = (MyEventCountKey) o;
>         return countDateTime.equals(that.countDateTime) &&
>                 domain.equals(that.domain) &&
>                 event.equals(that.event);
>     }
>
>     @Override
>     public int hashCode() {
>         final int prime = 31;
>         int result = 1;
>         result = prime * result + countDateTime.hashCode();
>         result = prime * result + domain.hashCode();
>         result = prime * result +  event.hashCode();
>         return result;
>     }
> }
>
>

Reply via email to