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

x33g5p2x  于2022-01-20 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(104)

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

GroupReduceOperator.collect介绍

暂无

代码示例

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

@Test
public void testReduceOnNonKeyedDataset() throws Exception {
  final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  env.setParallelism(4);
  // creates the input data and distributes them evenly among the available downstream tasks
  DataSet<Tuple2<Integer, Boolean>> input = createNonKeyedInput(env);
  List<Tuple2<Integer, Boolean>> actual = input.reduceGroup(new NonKeyedCombReducer()).collect();
  String expected = "10,true\n";
  compareResultAsTuples(actual, expected);
}

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

@Test
public void testReduceOnKeyedDataset() throws Exception {
  // set up the execution environment
  final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  env.setParallelism(4);
  // creates the input data and distributes them evenly among the available downstream tasks
  DataSet<Tuple3<String, Integer, Boolean>> input = createKeyedInput(env);
  List<Tuple3<String, Integer, Boolean>> actual = input.groupBy(0).reduceGroup(new KeyedCombReducer()).collect();
  String expected = "k1,6,true\nk2,4,true\n";
  compareResultAsTuples(actual, expected);
}

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

@Test
public void testReduceOnKeyedDatasetWithSelector() throws Exception {
  // set up the execution environment
  final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  env.setParallelism(4);
  // creates the input data and distributes them evenly among the available downstream tasks
  DataSet<Tuple3<String, Integer, Boolean>> input = createKeyedInput(env);
  List<Tuple3<String, Integer, Boolean>> actual = input
    .groupBy(new KeySelectorX())
    .reduceGroup(new KeyedCombReducer())
    .collect();
  String expected = "k1,6,true\nk2,4,true\n";
  compareResultAsTuples(actual, expected);
}

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

.filter(line -> line.startsWith("@relation"))
      .first(1)
      .collect();
}catch (Exception ex){
  throw new UndeclaredThrowableException(ex);

相关文章