mjsax commented on a change in pull request #11582:
URL: https://github.com/apache/kafka/pull/11582#discussion_r771749813



##########
File path: streams/src/main/java/org/apache/kafka/streams/query/QueryResult.java
##########
@@ -197,6 +197,18 @@ public R getResult() {
         return result;
     }
 
+    @SuppressWarnings("unchecked")
+    public <V> QueryResult<V> swapResult(final V value) {
+        if (isFailure()) {
+            return (QueryResult<V>) this;
+        } else {
+            final QueryResult<V> result = new QueryResult<>(value);

Review comment:
       I mean, if the upper layers need `QueryResult<R>` with proper type, and 
the inner layers need `QueryResult<bytes[]>`, we should just have two properly 
types object, and instead of "swapping", just take the `byte[]` from 
`QueryResult<bytes[]>`, deserialize them, and stuff the result into the 
`QueryResult<R>` object.
   
   > but this is the API we agreed on in the KIP.
   
   I did not read the KIP :D (maybe I should have). And we can always adjust 
it. So me it seems useless to have a generic type parameter if we don't obey it 
anyway, and use casts. It's the purpose of generics to avoid casts, and if it 
does not avoid casts, it seems pointless to have).




-- 
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