public static <R> QueryResult<R> copyAndSubstituteDeserializedResult(
        final QueryResult<?> rawResult,
        final R deserializedResult) {

        if (rawResult.isFailure()) {
            throw new IllegalArgumentException(
                "Callers must avoid calling this method on a failed result."
            );
        } else {
            return new SucceededQueryResult<>(
                deserializedResult,
                rawResult.getExecutionInfo(),
                rawResult.getPosition()
            );
        }
    }
Creates a new `QueryResult` preserving the execution info
and position of the provided result.
streams/src/main/java/org/apache/kafka/streams/query/internals/InternalQueryResultUtil.java