Package org.apache.flink.api.java

Examples of org.apache.flink.api.java.ExecutionEnvironment.generateSequence()


  public void testAllReduceWithCombiner() {
    try {
      ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      env.setDegreeOfParallelism(8);
     
      DataSet<Long> data = env.generateSequence(1, 8000000).name("source");
     
      data.reduce(new RichReduceFunction<Long>() {
       
        @Override
        public Long reduce(Long value1, Long value2){
View Full Code Here


  public void testAllReduceWithCombiner() {
    try {
      ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      env.setDegreeOfParallelism(8);
     
      DataSet<Long> data = env.generateSequence(1, 8000000).name("source");
     
      GroupReduceOperator<Long, Long> reduced = data.reduceGroup(new RichGroupReduceFunction<Long, Long>() {
        public void reduce(Iterable<Long> values, Collector<Long> out) {}
      }).name("reducer");
     
View Full Code Here

    try {
      final int NUM_ELEMENTS = 100;
     
      ExecutionEnvironment env = new CollectionEnvironment();
     
      env.generateSequence(1, NUM_ELEMENTS)
        .map(new CountingMapper())
        .output(new DiscardingOuputFormat<Long>());
     
      JobExecutionResult result = env.execute();
     
View Full Code Here

    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    // count how many of the samples would randomly fall into
    // the unit circle
    DataSet<Long> count =
        env.generateSequence(1, numSamples)
        .map(new Sampler())
        .reduce(new SumReducer());

    // the ratio of the unit circle surface to 4 times the unit square is pi
    DataSet<Double> pi = count
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.