org.apache.flink.api.java.operators.MapOperator.count()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(76)

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

MapOperator.count介绍

暂无

代码示例

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

/**
 * Checks that the edge set input contains valid vertex Ids, i.e. that they
 * also exist in the vertex input set.
 *
 * @return a boolean stating whether a graph is valid
 *         with respect to its vertex ids.
 */
@Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
  DataSet<Tuple1<K>> edgeIds = graph.getEdges()
      .flatMap(new MapEdgeIds<>()).distinct();
  DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
      .equalTo(0).with(new GroupInvalidIds<>()).first(1);
  return invalidIds.map(new KToTupleMap<>()).count() == 0;
}

代码示例来源:origin: amidst/toolbox

public static void main(String[] args) throws Exception {
  //BasicConfigurator.configure();
  //PropertyConfigurator.configure(args[0]);
  final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  logger.info("Entering application.");
  DataSet<String> text = env.fromElements(
      "Who's there?",
      "I think I hear them. Stand, ho! Who's there?");
  List<Integer> elements = new ArrayList<Integer>();
  elements.add(0);
  DataSet<TestClass> set = env.fromElements(new TestClass(elements));
  DataSet<Tuple2<String, Integer>> wordCounts = text
      .flatMap(new LineSplitter())
      .withBroadcastSet(set, "set")
      .groupBy(0)
      .sum(1);
  //wordCounts.writeAsText("output.txt", FileSystem.WriteMode.OVERWRITE);
  wordCounts.map(new PrintTuple()).count();
}

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

/**
 * Checks that the edge set input contains valid vertex Ids, i.e. that they
 * also exist in the vertex input set.
 *
 * @return a boolean stating whether a graph is valid
 *         with respect to its vertex ids.
 */
@Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
  DataSet<Tuple1<K>> edgeIds = graph.getEdges()
      .flatMap(new MapEdgeIds<>()).distinct();
  DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
      .equalTo(0).with(new GroupInvalidIds<>()).first(1);
  return invalidIds.map(new KToTupleMap<>()).count() == 0;
}

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

/**
 * Checks that the edge set input contains valid vertex Ids, i.e. that they
 * also exist in the vertex input set.
 * 
 * @return a boolean stating whether a graph is valid
 *         with respect to its vertex ids.
 */
@Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
  DataSet<Tuple1<K>> edgeIds = graph.getEdges()
      .flatMap(new MapEdgeIds<K, EV>()).distinct();
  DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
      .equalTo(0).with(new GroupInvalidIds<K, VV>()).first(1);
  return invalidIds.map(new KToTupleMap<K>()).count() == 0;
}

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

/**
 * Checks that the edge set input contains valid vertex Ids, i.e. that they
 * also exist in the vertex input set.
 *
 * @return a boolean stating whether a graph is valid
 *         with respect to its vertex ids.
 */
@Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
  DataSet<Tuple1<K>> edgeIds = graph.getEdges()
      .flatMap(new MapEdgeIds<>()).distinct();
  DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
      .equalTo(0).with(new GroupInvalidIds<>()).first(1);
  return invalidIds.map(new KToTupleMap<>()).count() == 0;
}

相关文章