aliehsaeedii commented on code in PR #14626:
URL: https://github.com/apache/kafka/pull/14626#discussion_r1384199383


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/StoreQueryUtils.java:
##########
@@ -351,6 +383,21 @@ public static <V> Function<byte[], V> 
getDeserializeValue(final StateSerdes<?, V
         return byteArray -> deserializer.deserialize(serdes.topic(), 
byteArray);
     }
 
+    public static <V> ValueIterator<VersionedRecord<V>> 
deserializeValueIterator(final StateSerdes<?, V> serdes,
+        final ValueIterator<VersionedRecord<byte[]>> rawValueIterator) {
+
+        final List<VersionedRecord<V>> versionedRecords = new ArrayList<>();
+        while (rawValueIterator.hasNext()) {
+            final VersionedRecord<byte[]> rawVersionedRecord = 
rawValueIterator.peek();
+            final Deserializer<V> valueDeserializer = 
serdes.valueDeserializer();
+            final long timestamp = rawVersionedRecord.timestamp();
+            final long validTo = rawVersionedRecord.validTo();
+            final V value = valueDeserializer.deserialize(serdes.topic(), 
rawVersionedRecord.value());

Review Comment:
   > I think we should not eagerly deserialize the result, but rather wrap the 
`rawValueIterator` with a `typesIterator` which does only deserialize the 
result that was requested via a `next()` call by the application.
   
   Maybe we should discuss it more.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to