org.apache.flink.api.common.accumulators.Accumulator.clone()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.apache.flink.api.common.accumulators.Accumulator.clone()方法的一些代码示例,展示了Accumulator.clone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accumulator.clone()方法的具体详情如下:
包路径:org.apache.flink.api.common.accumulators.Accumulator
类名称:Accumulator
方法名:clone

Accumulator.clone介绍

[英]Duplicates the accumulator. All subclasses need to properly implement cloning and cannot throw a java.lang.CloneNotSupportedException
[中]复制累加器。所有子类都需要正确实现克隆,并且不能抛出java。lang.CloneNotSupportedException

代码示例

代码示例来源:origin: apache/flink

public static Map<String, Accumulator<?, ?>> copy(Map<String, Accumulator<?, ?>> accumulators) {
  Map<String, Accumulator<?, ?>> result = new HashMap<String, Accumulator<?, ?>>();
  for (Map.Entry<String, Accumulator<?, ?>> entry: accumulators.entrySet()){
    result.put(entry.getKey(), entry.getValue().clone());
  }
  return result;
}

代码示例来源:origin: apache/flink

wrapUnchecked(otherEntry.getKey(), () -> otherEntry.getValue().clone()));
wrapUnchecked(otherEntry.getKey(), () -> mergeSingle(accumulator, otherEntry.getValue().clone())));

代码示例来源:origin: org.apache.flink/flink-core

public static Map<String, Accumulator<?, ?>> copy(Map<String, Accumulator<?, ?>> accumulators) {
  Map<String, Accumulator<?, ?>> result = new HashMap<String, Accumulator<?, ?>>();
  for (Map.Entry<String, Accumulator<?, ?>> entry: accumulators.entrySet()){
    result.put(entry.getKey(), entry.getValue().clone());
  }
  return result;
}

代码示例来源:origin: com.alibaba.blink/flink-core

public static Map<String, Accumulator<?, ?>> copy(Map<String, Accumulator<?, ?>> accumulators) {
  Map<String, Accumulator<?, ?>> result = new HashMap<String, Accumulator<?, ?>>();
  for (Map.Entry<String, Accumulator<?, ?>> entry: accumulators.entrySet()){
    result.put(entry.getKey(), entry.getValue().clone());
  }
  return result;
}

代码示例来源: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: org.apache.flink/flink-core

wrapUnchecked(otherEntry.getKey(), () -> otherEntry.getValue().clone()));
wrapUnchecked(otherEntry.getKey(), () -> mergeSingle(accumulator, otherEntry.getValue().clone())));

代码示例来源:origin: com.alibaba.blink/flink-core

wrapUnchecked(otherEntry.getKey(), () -> otherEntry.getValue().clone()));
wrapUnchecked(otherEntry.getKey(), () -> mergeSingle(accumulator, otherEntry.getValue().clone())));

代码示例来源: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);
}

相关文章