Examples of MapOperator


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

    // create DataSourceContract 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();

    // the mapper computes the distance to all points, which it draws from a broadcast variable
    MapOperator findNearestClusterCenters = MapOperator.builder(new SelectNearestCenter())
      .setBroadcastVariable("centers", clusterPoints)
      .input(dataPoints)
      .name("Find Nearest Centers")
      .build();
View Full Code Here

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

   
    FileDataSink result =
        new FileDataSink(new StringTupleDataOutFormat(), this.outputPath, "Output");
    result.setDegreeOfParallelism(degreeOfParallelism);
   
    MapOperator lineFilter =
        MapOperator.builder(LiFilter.class)
      .name("LineItemFilter")
      .build();
    lineFilter.setDegreeOfParallelism(degreeOfParallelism);
   
    MapOperator ordersFilter =
        MapOperator.builder(OFilter.class)
      .name("OrdersFilter")
      .build();
    ordersFilter.setDegreeOfParallelism(degreeOfParallelism);
   
    JoinOperator join =
        JoinOperator.builder(JoinLiO.class, IntValue.class, 0, 0)
      .name("OrdersLineitemsJoin")
      .build();
      join.setDegreeOfParallelism(degreeOfParallelism);
   
    ReduceOperator aggregation =
        ReduceOperator.builder(CountAgg.class, StringValue.class, 0)
      .name("AggregateGroupBy")
      .build();
    aggregation.setDegreeOfParallelism(this.degreeOfParallelism);
   
    lineFilter.setInput(lineItems);
    ordersFilter.setInput(orders);
    join.setFirstInput(ordersFilter);
    join.setSecondInput(lineFilter);
    aggregation.setInput(join);
    result.setInput(aggregation);
   
View Full Code Here

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

    String path2 = config.getBoolean("input2PathHasData", false) ? textInput : emptyInput;
   
    FileDataSource input1 = new FileDataSource(new ContractITCaseInputFormat(), path1);
    FileDataSource input2 = new FileDataSource(new ContractITCaseInputFormat(), path2);
   
    MapOperator testMapper1 = MapOperator.builder(new TestMapper()).build();
    MapOperator testMapper2 = MapOperator.builder(new TestMapper()).build();

    FileDataSink output = new FileDataSink(new ContractITCaseOutputFormat(), resultDir);

    testMapper1.setInput(input1);
    testMapper2.setInput(input2);

    output.addInput(testMapper1);
    output.addInput(testMapper2);
   
    Plan plan = new Plan(output);
View Full Code Here

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

    iteration.setMaximumNumberOfIterations(2);

    ReduceOperator dummyReduce = ReduceOperator.builder(new DummyReducer(), IntValue.class, 0).input(iteration.getPartialSolution())
        .name("Reduce something").build();

    MapOperator dummyMap = MapOperator.builder(new IdentityMapper()).input(dummyReduce).build();
    iteration.setNextPartialSolution(dummyMap);

    FileDataSink finalResult = new FileDataSink(new PointOutFormat(), output, iteration, "Output");

    Plan plan = new Plan(finalResult, "Iteration with chained map test");
View Full Code Here

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

    final int maxIterations = (args.length > 4 ? Integer.parseInt(args[4]) : 1);

    // 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

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

  public static Plan getPlan(int numSubTasks, String verticesInput, String edgeInput, String output, int maxIterations, boolean extraMap) {

    // 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();
   
    // the loop takes the vertices as the solution set and changed vertices as the workset
    // initially, all vertices are changed
    DeltaIteration iteration = new DeltaIteration(0, "Connected Components Iteration");
    iteration.setInitialSolutionSet(verticesWithId);
    iteration.setInitialWorkset(verticesWithId);
    iteration.setMaximumNumberOfIterations(maxIterations);
   
    // data source for the edges
    FileDataSource edges = new FileDataSource(new CsvInputFormat(' ', LongValue.class, LongValue.class), edgeInput, "Edges");

    // join workset (changed vertices) with the edges to propagate changes to neighbors
    JoinOperator joinWithNeighbors = JoinOperator.builder(new NeighborWithComponentIDJoin(), LongValue.class, 0, 0)
        .input1(iteration.getWorkset())
        .input2(edges)
        .name("Join Candidate Id With Neighbor")
        .build();

    // find for each neighbor the smallest of all candidates
    ReduceOperator minCandidateId = ReduceOperator.builder(new MinimumComponentIDReduce(), LongValue.class, 0)
        .input(joinWithNeighbors)
        .name("Find Minimum Candidate Id")
        .build();
   
    // join candidates with the solution set and update if the candidate component-id is smaller
    JoinOperator updateComponentId = JoinOperator.builder(new UpdateComponentIdMatchNonPreserving(), LongValue.class, 0, 0)
        .input1(minCandidateId)
        .input2(iteration.getSolutionSet())
        .name("Update Component Id")
        .build();
   
    if (extraMap) {
      MapOperator mapper = MapOperator.builder(IdentityMap.class).input(updateComponentId).name("idmap").build();
      iteration.setSolutionSetDelta(mapper);
    } else {
      iteration.setSolutionSetDelta(updateComponentId);
    }
   
View Full Code Here

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

    final int maxIterations = (args.length > 4 ? Integer.parseInt(args[4]) : 1);

    // 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();
   
    // the loop takes the vertices as the solution set and changed vertices as the workset
    // initially, all vertices are changed
    DeltaIteration iteration = new DeltaIteration(0, "Connected Components Iteration");
    iteration.setInitialSolutionSet(verticesWithId);
View Full Code Here

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

   
    FileDataSink result =
      new FileDataSink(new StringTupleDataOutFormat(), this.outputPath, "Output");
    result.setDegreeOfParallelism(this.degreeOfParallelism);
   
    MapOperator lineItemFilter =
      MapOperator.builder(new LineItemFilter())
      .name("LineItem Filter")
      .build();
    lineItemFilter.setDegreeOfParallelism(this.degreeOfParallelism);
   
    ReduceOperator groupByReturnFlag =
      ReduceOperator.builder(new GroupByReturnFlag(), StringValue.class, 0)
      .name("groupyBy")
      .build();
   
    lineItemFilter.setInput(lineItems);
    groupByReturnFlag.setInput(lineItemFilter);
    result.setInput(groupByReturnFlag);
   
    return new Plan(result, "TPC-H 1");
  }
View Full Code Here

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

        new ContractITCaseInputFormat(), input2Path);
    DelimitedInputFormat.configureDelimitedFormat(input2)
      .recordDelimiter('\n');
    input2.setDegreeOfParallelism(config.getInteger("UnionTest#NoSubtasks", 1));
   
    MapOperator testMapper = MapOperator.builder(new TestMapper()).build();
    testMapper.setDegreeOfParallelism(config.getInteger("UnionTest#NoSubtasks", 1));

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

    output.setInput(testMapper);

    testMapper.addInput(input1);
    testMapper.addInput(input2);

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

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

        .name("Compute sum (Reduce)")
        .build();
   
    iteration.setNextPartialSolution(sumReduce);
   
    MapOperator terminationMapper = MapOperator.builder(new TerminationMapper())
        .input(sumReduce)
        .name("Compute termination criterion (Map)")
        .build();
   
    iteration.setTerminationCriterion(terminationMapper);
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.