You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vallargeRangeHashCode= (Long.MinValue to Long.MaxValue).hashCode()
Output
java.lang.IllegalArgumentException: More than Int.MaxValue elements.
at scala.collection.immutable.NumericRange$.check$1(NumericRange.scala:330)
at scala.collection.immutable.NumericRange$.count(NumericRange.scala:361)
at scala.collection.immutable.NumericRange.length$lzycompute(NumericRange.scala:75)
at scala.collection.immutable.NumericRange.length(NumericRange.scala:75)
at scala.util.hashing.MurmurHash3.indexedSeqHash(MurmurHash3.scala:239)
at scala.util.hashing.MurmurHash3$.seqHash(MurmurHash3.scala:354)
at scala.collection.immutable.NumericRange.hashCode$lzycompute(NumericRange.scala:246)
at scala.collection.immutable.NumericRange.hashCode(NumericRange.scala:246)
... 32 elided
Expectation
The hash code of a numeric range should be calculated. It seems that NumericRange uses MurmurHash3.indexedSeqHash which evaluates all values in the range to compute the hash code.
Additionally, even when the range is small enough, the hash code computation is ineffective and may affect the code performance e.g. when a Set[NumericRange[Long]] is used.
The text was updated successfully, but these errors were encountered:
Compiler version
3.3.0
Minimized code
Output
Expectation
The hash code of a numeric range should be calculated. It seems that
NumericRange
usesMurmurHash3.indexedSeqHash
which evaluates all values in the range to compute the hash code.Additionally, even when the range is small enough, the hash code computation is ineffective and may affect the code performance e.g. when a
Set[NumericRange[Long]]
is used.The text was updated successfully, but these errors were encountered: