[jira] [Created] (FLINK-13880) The behavior of JobExecutionResult.getAccumulatorResult does not match its java doc

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-13880) The behavior of JobExecutionResult.getAccumulatorResult does not match its java doc

Shang Yuanchun (Jira)
Caizhi Weng created FLINK-13880:
-----------------------------------

             Summary: The behavior of JobExecutionResult.getAccumulatorResult does not match its java doc
                 Key: FLINK-13880
                 URL: https://issues.apache.org/jira/browse/FLINK-13880
             Project: Flink
          Issue Type: Bug
            Reporter: Caizhi Weng


The java doc of `JobExecutionResult.getAccumulatorResult` states that "Returns \{@code null}, if no accumulator with that name was produced", but actually an NPE will be triggered if no accumulator with that name is produced.

I'm going to rewrite the `getAccumulatorResult` method to the following:
{code:java}
public <T> T getAccumulatorResult(String accumulatorName) {
   OptionalFailure<Object> result = this.accumulatorResults.get(accumulatorName);
   if (result != null) {
      return (T) result.getUnchecked();
   } else {
      return null;
   }
}
{code}
Please assign this issue to me if this solution is acceptable.

 



--
This message was sent by Atlassian Jira
(v8.3.2#803003)