Github user mxm commented on a diff in the pull request:
https://github.com/apache/flink/pull/930#discussion_r35204559
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java
---
@@ -580,6 +581,34 @@ public ExecutionContext getExecutionContext() {
return result;
}
+ /**
+ * Returns the a stringified version of the user-defined accumulators.
+ * @return an Array containing the StringifiedAccumulatorResult objects
+ */
+ public StringifiedAccumulatorResult[]
getAccumulatorResultsStringified() {
+
+ Map<String, Accumulator<?, ?>> accumulatorMap =
aggregateUserAccumulators();
+
+ int num = accumulatorMap.size();
+ StringifiedAccumulatorResult[] resultStrings = new
StringifiedAccumulatorResult[num];
+
+ int i = 0;
+ for (Map.Entry<String, Accumulator<?, ?>> entry :
accumulatorMap.entrySet()) {
+
+ StringifiedAccumulatorResult result;
+ Accumulator<?, ?> value = entry.getValue();
+ if (value != null) {
+ result = new
StringifiedAccumulatorResult(entry.getKey(), value.getClass().getSimpleName(),
value.toString());
+ } else {
+ result = new
StringifiedAccumulatorResult(entry.getKey(), "null", "null");
--- End diff --
StringifiedAccumulatorResult expects a String. I thought it's better to
pass a "null" String instead of null.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---