davidradl commented on code in PR #25815:
URL: https://github.com/apache/flink/pull/25815#discussion_r1894022766


##########
flink-runtime/src/test/java/org/apache/flink/streaming/util/KeyedTwoInputStreamOperatorTestHarness.java:
##########
@@ -64,8 +67,24 @@ public KeyedTwoInputStreamOperatorTestHarness(
     }
 
     public int numKeyedStateEntries() {
-        AbstractStreamOperator<?> abstractStreamOperator = 
(AbstractStreamOperator<?>) operator;
-        KeyedStateBackend<Object> keyedStateBackend = 
abstractStreamOperator.getKeyedStateBackend();
+        KeyedStateBackend<?> keyedStateBackend;
+        if (operator instanceof AbstractAsyncStateStreamOperator) {

Review Comment:
   as reflection is quite costly and the operator is an instance variable, can 
we organize the code so the reflection is done once and caches rather than on 
every access.
   
   I suggest either working out what type of operator we have in the 
constructor and stash in an instance variable; maybe using an enum for the 
types of operators  



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to