scio
scio copied to clipboard
Fix byte[] equality issue for MockByteArraySparkeyReader
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