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 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 . Or if we think that the types of operator are known and stable, then we could have the enum operatorType in the `AbstractStreamOperator` class, and set the appropriate value as each child is constructed; avoiding the instanceof completely. With method could then be a switch on the enum -- 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