bamaer commented on PR #9293:
URL: https://github.com/apache/hop/pull/9293#issuecomment-6677957094
**Should fix**
- `ValueMetaBase.hashCode` still breaks the contract for Integer, Binary,
String and Boolean metas. `equals` compares `getLength()` and `getPrecision()`,
but `hashCode` hashes the raw `length` and `precision` fields, and
`getPrecision()` returns a fixed 0 or -1 for those types. For example, `new
ValueMetaInteger("id")` and the same meta with `setPrecision(0)` are equal but
get different hash codes, and so do two `RowMeta`s that contain them.
`ValueMetaBase.java` L518-521. Suggested fix: hash `getLength()` and
`getPrecision()` instead of the fields. I tried this locally: the existing row
and value meta tests still pass, and the case above then hashes the same. It
may be worth adding that case to `equalValueMetasHaveEqualHashCodes`.
Built the PR and ran the `core` unit tests (all pass); checked that Checksum
and Combination lookup hash exact-size rows, so their stored hashes don't
change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]