Package org.apache.flink.api.java.record.operators

Examples of org.apache.flink.api.java.record.operators.MapOperator


        new ContractITCaseInputFormat(), inPath);
    DelimitedInputFormat.configureDelimitedFormat(input)
      .recordDelimiter('\n');
    input.setDegreeOfParallelism(config.getInteger("MapTest#NoSubtasks", 1));

    MapOperator testMapper = MapOperator.builder(new TestMapper()).build();
    testMapper.setDegreeOfParallelism(config.getInteger("MapTest#NoSubtasks", 1));

    FileDataSink output = new FileDataSink(
        new ContractITCaseOutputFormat(), resultPath);
    output.setDegreeOfParallelism(1);

    output.setInput(testMapper);
    testMapper.setInput(input);

    return new Plan(output);
  }
View Full Code Here


 
//  @Test
  public void testMapCancelling() throws Exception {
    GenericDataSource<InfiniteIntegerInputFormat> source = new GenericDataSource<InfiniteIntegerInputFormat>(
                                    new InfiniteIntegerInputFormat(), "Source");
    MapOperator mapper = MapOperator.builder(IdentityMapper.class)
      .input(source)
      .name("Identity Mapper")
      .build();
    GenericDataSink sink = new GenericDataSink(new DiscardingOutputFormat(), mapper, "Sink");
   
View Full Code Here

 
//  @Test
  public void testSlowMapCancelling() throws Exception {
    GenericDataSource<InfiniteIntegerInputFormat> source = new GenericDataSource<InfiniteIntegerInputFormat>(
                                    new InfiniteIntegerInputFormat(), "Source");
    MapOperator mapper = MapOperator.builder(DelayingIdentityMapper.class)
      .input(source)
      .name("Delay Mapper")
      .build();
    GenericDataSink sink = new GenericDataSink(new DiscardingOutputFormat(), mapper, "Sink");
   
View Full Code Here

 
//  @Test
  public void testMapWithLongCancellingResponse() throws Exception {
    GenericDataSource<InfiniteIntegerInputFormat> source = new GenericDataSource<InfiniteIntegerInputFormat>(
                                    new InfiniteIntegerInputFormat(), "Source");
    MapOperator mapper = MapOperator.builder(LongCancelTimeIdentityMapper.class)
      .input(source)
      .name("Long Cancelling Time Mapper")
      .build();
    GenericDataSink sink = new GenericDataSink(new DiscardingOutputFormat(), mapper, "Sink");
   
View Full Code Here

 
//  @Test
  public void testMapPriorToFirstRecordReading() throws Exception {
    GenericDataSource<InfiniteIntegerInputFormat> source = new GenericDataSource<InfiniteIntegerInputFormat>(
                                    new InfiniteIntegerInputFormat(), "Source");
    MapOperator mapper = MapOperator.builder(StuckInOpenIdentityMapper.class)
      .input(source)
      .name("Stuck-In-Open Mapper")
      .build();
    GenericDataSink sink = new GenericDataSink(new DiscardingOutputFormat(), mapper, "Sink");
   
View Full Code Here

    int numSubTasks   = (args.length > 0 ? Integer.parseInt(args[0]) : 1);
    String dataInput = (args.length > 1 ? args[1] : "");
    String output    = (args.length > 2 ? args[2] : "");

    FileDataSource source = new FileDataSource(new TextInputFormat(), dataInput, "Input Lines");
    MapOperator mapper = MapOperator.builder(new TokenizeLine())
      .input(source)
      .name("Tokenize Lines")
      .build();
    ReduceOperator reducer = ReduceOperator.builder(CountWords.class, StringValue.class, 0)
      .input(mapper)
View Full Code Here

      int numSubTasks, String verticesInput, String edgeInput, String output, int maxIterations)
  {
    // data source for initial vertices
    FileDataSource initialVertices = new FileDataSource(new CsvInputFormat(' ', LongValue.class), verticesInput, "Vertices");
   
    MapOperator verticesWithId = MapOperator.builder(DuplicateLongMap.class).input(initialVertices).name("Assign Vertex Ids").build();
   
    DeltaIteration iteration = new DeltaIteration(0, "Connected Components Iteration");
    iteration.setInitialSolutionSet(verticesWithId);
    iteration.setInitialWorkset(verticesWithId);
    iteration.setMaximumNumberOfIterations(maxIterations);
View Full Code Here

      .fieldDelimiter('|')
      .field(LongValue.class, 0)    // order id
      .field(DoubleValue.class, 5)// extended price

    // create MapOperator for filtering Orders tuples
    MapOperator filterO = MapOperator.builder(new FilterO())
      .input(orders)
      .name("FilterO")
      .build();
    // filter configuration
    filterO.setParameter(YEAR_FILTER, 1993);
    filterO.setParameter(PRIO_FILTER, "5");
    // compiler hints
    filterO.getCompilerHints().setFilterFactor(0.05f);

    // create JoinOperator for joining Orders and LineItems
    JoinOperator joinLiO = JoinOperator.builder(new JoinLiO(), LongValue.class, 0, 0)
      .input1(filterO)
      .input2(lineitems)
View Full Code Here

    // data source for cluster center input
    @SuppressWarnings("unchecked")
    FileDataSource clustersSource = new FileDataSource(new CsvInputFormat('|', IntValue.class, DoubleValue.class, DoubleValue.class, DoubleValue.class), clusterInput, "Centers");
   
    MapOperator dataPoints = MapOperator.builder(new PointBuilder()).name("Build data points").input(pointsSource).build();
   
    MapOperator clusterPoints = MapOperator.builder(new PointBuilder()).name("Build cluster points").input(clustersSource).build();
   
    // ---------------------- Begin K-Means Loop ---------------------
   
    BulkIteration iter = new BulkIteration("k-means loop");
    iter.setInput(clusterPoints);
    iter.setMaximumNumberOfIterations(numIterations);

    // compute the distances and select the closest center
    MapOperator findNearestClusterCenters = MapOperator.builder(new SelectNearestCenter())
      .setBroadcastVariable("centers", iter.getPartialSolution())
      .input(dataPoints)
      .name("Find Nearest Centers")
      .build();
View Full Code Here

        .input(joinWithSolutionSet)
        .name(NEXT_WORKSET_REDUCER_NAME)
        .build();
   
    if (mapBeforeSolutionDelta) {
      MapOperator mapper = MapOperator.builder(new IdentityMap())
        .input(joinWithSolutionSet)
        .name(SOLUTION_DELTA_MAPPER_NAME)
        .build();
      iteration.setSolutionSetDelta(mapper);
    } else {
View Full Code Here

TOP

Related Classes of org.apache.flink.api.java.record.operators.MapOperator

Copyright © 2018 www.massapicom. 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.