vvcephei commented on a change in pull request #11582: URL: https://github.com/apache/kafka/pull/11582#discussion_r771470456
########## 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; Review comment: In the case of a failure, there is no result, just the failure message. I wanted to maintain an invariant that there is always either a failure or a result, but not both or neither. I also didn't think it would be right to allow accidentally converting a failure to a successful result via this method. I suppose we could throw an IllegalStateException, since the caller probably shouldn't be even trying to "swap" the result on a failed result to begin with, but this seems fine, too. -- 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