scio icon indicating copy to clipboard operation
scio copied to clipboard

Fix byte[] equality issue for MockByteArraySparkeyReader

Open clairemcginty opened this issue 4 months ago • 0 comments

MockByteArraySparkeyReader was not working properly since two Array[Byte]s containing the same bytes produce a different hashCode every time they're deserialized -- thus, the Map#get operation was throwing a NoSuchElementException even if it contained an Array[Byte] key matching the requested key bytes.

This solution wraps map keys in a ByteBuffer, which is safe to use as a Map key. It also returns null if the key doesn't exist in the map rather than throwing a NoSuchElementException, which matches the prior Sparkey behavior

clairemcginty avatar Feb 20 '24 18:02 clairemcginty