本文整理了Java中org.apache.flink.api.common.accumulators.Accumulator.merge()
方法的一些代码示例,展示了Accumulator.merge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accumulator.merge()
方法的具体详情如下:
包路径:org.apache.flink.api.common.accumulators.Accumulator
类名称:Accumulator
方法名:merge
[英]Used by system internally to merge the collected parts of an accumulator at the end of the job.
[中]系统内部用于在作业结束时合并累加器的收集部分。
代码示例来源:origin: apache/flink
/**
* Workaround method for type safety.
*/
private static <V, R extends Serializable> Accumulator<V, R> mergeSingle(Accumulator<?, ?> target,
Accumulator<?, ?> toMerge) {
@SuppressWarnings("unchecked")
Accumulator<V, R> typedTarget = (Accumulator<V, R>) target;
@SuppressWarnings("unchecked")
Accumulator<V, R> typedToMerge = (Accumulator<V, R>) toMerge;
typedTarget.merge(typedToMerge);
return typedTarget;
}
代码示例来源:origin: org.apache.flink/flink-core
/**
* Workaround method for type safety.
*/
private static <V, R extends Serializable> Accumulator<V, R> mergeSingle(Accumulator<?, ?> target,
Accumulator<?, ?> toMerge) {
@SuppressWarnings("unchecked")
Accumulator<V, R> typedTarget = (Accumulator<V, R>) target;
@SuppressWarnings("unchecked")
Accumulator<V, R> typedToMerge = (Accumulator<V, R>) toMerge;
typedTarget.merge(typedToMerge);
return typedTarget;
}
代码示例来源:origin: com.alibaba.blink/flink-core
/**
* Workaround method for type safety.
*/
private static <V, R extends Serializable> Accumulator<V, R> mergeSingle(Accumulator<?, ?> target,
Accumulator<?, ?> toMerge) {
@SuppressWarnings("unchecked")
Accumulator<V, R> typedTarget = (Accumulator<V, R>) target;
@SuppressWarnings("unchecked")
Accumulator<V, R> typedToMerge = (Accumulator<V, R>) toMerge;
typedTarget.merge(typedToMerge);
return typedTarget;
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
@SuppressWarnings("unchecked")
void commitForTasks(JobVertexID jobVertexId, Accumulator value, Set<Integer> committedTasks) {
checkArgument(this.jobVertexId.equals(jobVertexId), "The registered task belongs to different JobVertex with previous registered ones");
if (aggregatedValue == null) {
aggregatedValue = value.clone();
} else {
aggregatedValue.merge(value);
}
this.committedTasks.addAll(committedTasks);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
@SuppressWarnings("unchecked")
void commitForTask(JobVertexID jobVertexId, int subtaskIndex, Accumulator value) {
checkArgument(this.jobVertexId.equals(jobVertexId),
"The registered task belongs to different JobVertex with previous registered ones");
checkState(registeredTasks.contains(subtaskIndex), "Can not commit for an accumulator that has " +
"not been registered before");
if (aggregatedValue == null) {
aggregatedValue = value.clone();
} else {
aggregatedValue.merge(value);
}
committedTasks.add(subtaskIndex);
}
内容来源于网络,如有侵权,请联系作者删除!