guozhangwang commented on a change in pull request #11582: URL: https://github.com/apache/kafka/pull/11582#discussion_r771744164
########## File path: streams/src/main/java/org/apache/kafka/streams/state/internals/StoreQueryUtils.java ########## @@ -162,15 +163,39 @@ public static boolean isPermitted( } final R result = (R) iterator; return QueryResult.forResult(result); - } catch (final Throwable t) { - final String message = parseStoreException(t, store, query); + } catch (final Exception e) { + final String message = parseStoreException(e, store, query); return QueryResult.forFailure( FailureReason.STORE_EXCEPTION, message ); } } + @SuppressWarnings("unchecked") + private static <R> QueryResult<R> runKeyQuery(final Query<R> query, + final PositionBound positionBound, + final boolean collectExecutionInfo, + final StateStore store) { + if (store instanceof KeyValueStore) { + final KeyQuery<Bytes, byte[]> rawKeyQuery = (KeyQuery<Bytes, byte[]>) query; + final KeyValueStore<Bytes, byte[]> keyValueStore = + (KeyValueStore<Bytes, byte[]>) store; + try { + final byte[] bytes = keyValueStore.get(rawKeyQuery.getKey()); + return (QueryResult<R>) QueryResult.forResult(bytes); Review comment: @vvcephei but in this PR at least, `Should we use swap here as well?`? -- 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