I have an avro schema named CompositeKey
with fields of <userId: int, attribute: string>
. Another avro schema named SimpleValue
.
Using Kafka Streams, I put them into a KeyValueStore using Avro serializer/deserializers.
myKeyValueStore.put(myCompositeKey, mySimpleValue);
Later on, using interactive queries I can get
userId, attribute
pairs one by one. But I'd like to also get all attributes
belonging to a single userId
. When I use,
store.range(
new CompositeKey(userID, lowestPossibleAttribute),
new CompositeKey(userID, highestPossibleAttribute))
it does not return all attributes. I guess that is caused because underlying RocksDB sorts them like byte arrays and avro serialization format messes with that.
Is there a way to do this partial range query using Avro in RocksDB? Otherwise I will have to store them with generated strings from Avro schema in the format of "<userId>+<attribute>"
.