Package org.apache.flink.api.java

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


        DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.get3TupleDataSet(env);
        DataSet<Tuple3<Integer, Long, String>> reduceDs = ds.
            groupBy(1).reduce(new InputReturningTuple3Reduce());
       
        reduceDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "1,1,Hi\n" +
            "5,2,Hi again!\n" +
            "15,3,Hi again!\n" +
View Full Code Here


                    return new Tuple2<Integer, Long>(t.f0, t.f4);
                  }
                }).reduce(new Tuple5Reduce());
       
        reduceDs.writeAsCsv(resultPath);
        env.execute();
       
        return "1,1,0,Hallo,1\n" +
            "2,3,2,Hallo Welt wie,1\n" +
            "2,2,1,Hallo Welt,2\n" +
            "3,9,0,P-),2\n" +
View Full Code Here

        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> reduceDs = ds.
            groupBy("f4","f0").reduce(new Tuple5Reduce());
       
        reduceDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "1,1,0,Hallo,1\n" +
            "2,3,2,Hallo Welt wie,1\n" +
            "2,2,1,Hallo Welt,2\n" +
View Full Code Here

    DataSet<Integer> result = data.reduceGroup(new PickOneAllReduce()).withBroadcastSet(iteration, "bc");
   
    final List<Integer> resultList = new ArrayList<Integer>();
    iteration.closeWith(result).output(new LocalCollectionOutputFormat<Integer>(resultList));
   
    env.execute();
   
    Assert.assertEquals(8, resultList.get(0).intValue());
  }

 
View Full Code Here

        DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.get3TupleDataSet(env);
        DataSet<Long> uniqLongs = ds
            .partitionByHash(1)
            .mapPartition(new UniqueLongMapper());
        uniqLongs.writeAsText(resultPath);
        env.execute();
       
        // return expected result
        return   "1\n" +
            "2\n" +
            "3\n" +
View Full Code Here

              }
             
            })
            .mapPartition(new UniqueLongMapper());
        uniqLongs.writeAsText(resultPath);
        env.execute();
       
        // return expected result
        return   "1\n" +
            "2\n" +
            "3\n" +
View Full Code Here

   
    DataSet<Record> result = iteration.union(iteration).map(new IdentityMapper());
   
    iteration.closeWith(result).write(new PointOutFormat(), this.resultPath);
   
    env.execute();
  }
 
  static final class IdentityMapper implements MapFunction<Record, Record>, Serializable {
    private static final long serialVersionUID = 1L;
View Full Code Here

             
            });
       
        uniqLongs.writeAsText(resultPath);
       
        env.execute();
       
        StringBuilder result = new StringBuilder();
        int numPerPartition = 2220 / env.getDegreeOfParallelism() / 10;
        for (int i = 0; i < env.getDegreeOfParallelism(); i++) {
          result.append('(').append(i).append(',').append(numPerPartition).append(")\n");
View Full Code Here

        DataSet<Long> uniqLongs = ds
            .partitionByHash(1).setParallelism(4)
            .mapPartition(new UniqueLongMapper());
        uniqLongs.writeAsText(resultPath);
       
        env.execute();
       
        // return expected result
        return   "1\n" +
            "2\n" +
            "3\n" +
View Full Code Here

        DataSet<Long> uniqLongs = ds
            .partitionByHash("nestedPojo.longNumber").setParallelism(4)
            .mapPartition(new UniqueNestedPojoLongMapper());
        uniqLongs.writeAsText(resultPath);
       
        env.execute();
       
        // return expected result
        return   "10000\n" +
            "20000\n" +
            "30000\n";
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.