Open mythrocks opened 1 year ago
Closing this as invalid; both hashCode()
and equals()
are correct.
Scalar.hashCode()
returns Objects.hashCode(type, valueHash)
. type
includes the scale.Scalar.equals()
compares type
first, before proceeding to compare values. type
, again, includes the scale.Apologies for the noise. This bug is invalid.
This issue has been labeled inactive-30d
due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d
if there is no activity in the next 60 days.
This would sill be good to fix
In its current implementation, the
Scalar
Java class does not consider thescale
of a scalar value, when comparing twoDECIMAL
scalars.Here is the section of
Scalar.equals()
that comparesDECIMAL64
values:getLong()
does not rescale the representative value of the scalar, based on a common scale. This implementation will equate twoDECIMAL64
scalars of different scales, if theirrep
values are equal.A similar argument could be made for
Scalar.hashCode()
:AFAICT, the problem applies to
DECIMAL32
andDECIMAL64
, but notDECIMAL128
. In adding support forDECIMAL128
in #11645, the comparisons are made usingBigDecimal
, rather thanBigInteger
.