Add equals/hashCode to RangeTermTree$Term to make sure it plays nicely with IntervalNode construction

patch by Caleb Rackliffe; reviewed by Ariel Weisberg for CASSANDRA-20866
This commit is contained in:
Caleb Rackliffe 2025-10-07 18:53:04 -05:00
parent 61959e215c
commit c12cc0b026
1 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.apache.cassandra.index.sai.view;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.slf4j.Logger;
@ -124,5 +125,19 @@ public class RangeTermTree
{
return MoreObjects.toStringHelper(this).add("term", indexTermType.asString(term)).toString();
}
@Override
public boolean equals(Object other)
{
if (other == null || getClass() != other.getClass()) return false;
Term otherTerm = (Term) other;
return Objects.equals(term, otherTerm.term) && Objects.equals(indexTermType, otherTerm.indexTermType);
}
@Override
public int hashCode()
{
return Objects.hash(term, indexTermType);
}
}
}