You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "KalleOlaviNiemitalo (via GitHub)" <gi...@apache.org> on 2024/09/25 01:56:34 UTC
Re: [PR] AVRO-4060: Use JDK to Hash Byte Array in UTF8 [avro]
KalleOlaviNiemitalo commented on PR #3175:
URL: https://github.com/apache/avro/pull/3175#issuecomment-2372726325
I feel there should be a test to verify that the result of Utf8.hashCode does not depend on whether the array has unused bytes in it. TestUtf8.hashCodeReused seems to largely cover that by hardcoding specific hash codes but it does not compute hash codes for equal sequences of bytes in two ways. I'm thinking about test code like
```java
Utf8 u1 = new Utf8("abcdefghi"); // length=9, bytes.length=9
u1.setByteLength(8); // length=8, bytes.length=9
Utf8 u2 = new Utf8("abcdefgh"); // length=8, bytes.length=8
assertEquals(u1.hashCode(), u2.getHashCode());
```
or with a hardcoded hash code in the test.
--
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org