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



##########
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:
       Thanks; let's keep that in mind as we tackle some of the API refactor 
tasks we've queued up. We started with the RawXQuery approach, then dropped it. 
Before we add it back, I think we'd better have a representative set of queries 
and also bear in mind all the other sharp edges we'd like to smooth over before 
release.




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