Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2969#discussion_r91703632
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamingRuntimeContext.java
 ---
    @@ -106,17 +109,45 @@ public boolean hasBroadcastVariable(String name) {
     
        @Override
        public <T> ValueState<T> getState(ValueStateDescriptor<T> 
stateProperties) {
    -           return operator.getKeyedStateStore().getState(stateProperties);
    +           KeyedStateStore keyedStateStore = 
checkPreconditionsAndGetKeyedStateStore(stateProperties);
    +
    +           try {
    +                   
stateProperties.initializeSerializerUnlessSet(getExecutionConfig());
    +                   return keyedStateStore.getState(stateProperties);
    +           } catch (Exception e) {
    +                   throw new RuntimeException("Error while getting state", 
e);
    +           }
        }
     
        @Override
        public <T> ListState<T> getListState(ListStateDescriptor<T> 
stateProperties) {
    -           return 
operator.getKeyedStateStore().getListState(stateProperties);
    +           KeyedStateStore keyedStateStore = 
checkPreconditionsAndGetKeyedStateStore(stateProperties);
    +
    +           try {
    +                   
stateProperties.initializeSerializerUnlessSet(getExecutionConfig());
    +                   return keyedStateStore.getListState(stateProperties);
    +           } catch (Exception e) {
    +                   throw new RuntimeException("Error while getting state", 
e);
    +           }
        }
     
        @Override
        public <T> ReducingState<T> getReducingState(ReducingStateDescriptor<T> 
stateProperties) {
    -           return 
operator.getKeyedStateStore().getReducingState(stateProperties);
    +           KeyedStateStore keyedStateStore = 
checkPreconditionsAndGetKeyedStateStore(stateProperties);
    +
    +           try {
    +                   
stateProperties.initializeSerializerUnlessSet(getExecutionConfig());
    +                   return 
keyedStateStore.getReducingState(stateProperties);
    +           } catch (Exception e) {
    +                   throw new RuntimeException("Error while getting state", 
e);
    --- End diff --
    
    Do we need to re-wrap the exceptions here? Can we simply let the original 
exception bubble up?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to