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

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


  @SuppressWarnings("unchecked")
  @Test
  public void testUnionPropertyOldApiPropagation() {
    // construct the plan

    FileDataSource sourceA = new FileDataSource(new DummyInputFormat(), IN_FILE);
    FileDataSource sourceB = new FileDataSource(new DummyInputFormat(), IN_FILE);
   
    ReduceOperator redA = ReduceOperator.builder(new IdentityReduce(), IntValue.class, 0)
      .input(sourceA)
      .build();
    ReduceOperator redB = ReduceOperator.builder(new IdentityReduce(), IntValue.class, 0)
View Full Code Here


    final String edgeInput = args.length > 1 ? args[1] : "";
    final String output    = args.length > 2 ? args[2] : "";
    final char delimiter   = args.length > 3 ? (char) Integer.parseInt(args[3]) : ',';
   

    FileDataSource edges = new FileDataSource(new EdgeInputFormat(), edgeInput, "Input Edges");
    edges.setParameter(EdgeInputFormat.ID_DELIMITER_CHAR, delimiter);

    // =========================== Vertex Degree ============================
   
    MapOperator projectEdge = MapOperator.builder(new ProjectEdge())
        .input(edges).name("Project Edge").build();
View Full Code Here

      this.outputPath = args[7];
    }
   
    /* Create the 6 data sources: */
    /* part: (partkey | name, mfgr, brand, type, size, container, retailprice, comment) */
    FileDataSource partInput = new FileDataSource(
      new IntTupleDataInFormat(), this.partInputPath, "\"part\" source");
    //partInput.setOutputContract(UniqueKey.class);
//    partInput.getCompilerHints().setAvgNumValuesPerKey(1);

    /* partsupp: (partkey | suppkey, availqty, supplycost, comment) */
    FileDataSource partSuppInput = new FileDataSource(
      new IntTupleDataInFormat(), this.partSuppInputPath, "\"partsupp\" source");

    /* orders: (orderkey | custkey, orderstatus, totalprice, orderdate, orderpriority, clerk, shippriority, comment) */
    FileDataSource ordersInput = new FileDataSource(
      new IntTupleDataInFormat(), this.ordersInputPath, "\"orders\" source");
    //ordersInput.setOutputContract(UniqueKey.class);
//    ordersInput.getCompilerHints().setAvgNumValuesPerKey(1);

    /* lineitem: (orderkey | partkey, suppkey, linenumber, quantity, extendedprice, discount, tax, ...) */
    FileDataSource lineItemInput = new FileDataSource(
      new IntTupleDataInFormat(), this.lineItemInputPath, "\"lineitem\" source");

    /* supplier: (suppkey | name, address, nationkey, phone, acctbal, comment) */
    FileDataSource supplierInput = new FileDataSource(
      new IntTupleDataInFormat(), this.supplierInputPath, "\"supplier\" source");
    //supplierInput.setOutputContract(UniqueKey.class);
//    supplierInput.getCompilerHints().setAvgNumValuesPerKey(1);

    /* nation: (nationkey | name, regionkey, comment) */
    FileDataSource nationInput = new FileDataSource(
      new IntTupleDataInFormat(), this.nationInputPath, "\"nation\" source");
    //nationInput.setOutputContract(UniqueKey.class);
//    nationInput.getCompilerHints().setAvgNumValuesPerKey(1);

    /* Filter on part's name, project values to NULL: */
 
View Full Code Here

    // parse job parameters
    int numSubTasks   = (args.length > 0 ? Integer.parseInt(args[0]) : 1);
    String edgeInput = (args.length > 1 ? args[1] : "");
    String output    = (args.length > 2 ? args[2] : "");

    FileDataSource edges = new FileDataSource(new EdgeInFormat(), edgeInput, "BTC Edges");
   
    ReduceOperator buildTriads = ReduceOperator.builder(new BuildTriads(), StringValue.class, 0)
      .name("Build Triads")
      .build();
View Full Code Here

    int numSubTasks   = (args.length > 0 ? Integer.parseInt(args[0]) : 1);
    String paths     = (args.length > 1 ? args[1] : "");
    String output    = (args.length > 2 ? args[2] : "");
    boolean rdfInput = (args.length > 3 ? Boolean.parseBoolean(args[3]) : false);

    FileDataSource pathsInput;
   
    if(rdfInput) {
      pathsInput = new FileDataSource(new RDFTripleInFormat(), paths, "RDF Triples");
    } else {
      pathsInput = new FileDataSource(new PathInFormat(), paths, "Paths");
    }
    pathsInput.setDegreeOfParallelism(numSubTasks);

    JoinOperator concatPaths =
        JoinOperator.builder(new ConcatPaths(), StringValue.class, 0, 1)
      .name("Concat Paths")
      .build();
View Full Code Here

  public Plan getPlan(int numSubTasks, String dataInput, String output) {


    // input is {word, count} pair
    FileDataSource source = new FileDataSource(new TextInputFormat(), dataInput, "Input Lines");

    //do a selection using cached file
    MapOperator mapper = MapOperator.builder(new TokenizeLine())
      .input(source)
      .name("Tokenize Lines")
View Full Code Here

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

    // create DataSourceContract for Orders input
    @SuppressWarnings("unchecked")
    CsvInputFormat format1 = new CsvInputFormat('|', IntValue.class, IntValue.class);
    FileDataSource input1 = new FileDataSource(format1, input1Path, "Input 1");
   
    ReduceOperator aggInput1 = ReduceOperator.builder(DummyReduce.class, IntValue.class, 0)
      .input(input1)
      .name("AggOrders")
      .build();

   
    // create DataSourceContract for Orders input
    @SuppressWarnings("unchecked")
    CsvInputFormat format2 = new CsvInputFormat('|', IntValue.class, IntValue.class);
    FileDataSource input2 = new FileDataSource(format2, input2Path, "Input 2");
    input2.setDegreeOfParallelism(numSubtasksInput2);

    ReduceOperator aggInput2 = ReduceOperator.builder(DummyReduce.class, IntValue.class, 0)
      .input(input2)
      .name("AggLines")
      .build();
View Full Code Here

    final String dependencySetInput = (args.length > 3 ? args[3] : "");
    final String output = (args.length > 4 ? args[4] : "");
    final int maxIterations = (args.length > 5 ? Integer.parseInt(args[5]) : 1);
   
    // create DataSourceContract for the initalSolutionSet
    FileDataSource initialSolutionSet = new FileDataSource(new CsvInputFormat(' ', LongValue.class, DoubleValue.class), solutionSetInput, "Initial Solution Set");

    // create DataSourceContract for the initalDeltaSet
    FileDataSource initialDeltaSet = new FileDataSource(new CsvInputFormat(' ', LongValue.class, DoubleValue.class), deltasInput, "Initial DeltaSet");
       
    // create DataSourceContract for the edges
    FileDataSource dependencySet = new FileDataSource(new CsvInputFormat(' ', LongValue.class, LongValue.class, LongValue.class), dependencySetInput, "Dependency Set");
   
    DeltaIteration iteration = new DeltaIteration(0, "Delta PageRank");
    iteration.setInitialSolutionSet(initialSolutionSet);
    iteration.setInitialWorkset(initialDeltaSet);
    iteration.setMaximumNumberOfIterations(maxIterations);
View Full Code Here

   
    String lineitemsPath = (args.length > 5 ? args[5] : "");
    String output        = (args.length > 6 ? args[6] : "");

    // create DataSourceContract for Orders input
    FileDataSource orders1 = new FileDataSource(new CsvInputFormat(), orders1Path, "Orders 1");
    CsvInputFormat.configureRecordFormat(orders1)
      .recordDelimiter('\n')
      .fieldDelimiter('|')
      .field(LongValue.class, 0)    // order id
      .field(IntValue.class, 7)     // ship prio
      .field(StringValue.class, 2, 2// order status
      .field(StringValue.class, 4, 10// order date
      .field(StringValue.class, 5, 8)// order prio
   
    FileDataSource orders2 = new FileDataSource(new CsvInputFormat(), orders2Path, "Orders 2");
    CsvInputFormat.configureRecordFormat(orders2)
      .recordDelimiter('\n')
      .fieldDelimiter('|')
      .field(LongValue.class, 0)    // order id
      .field(IntValue.class, 7)     // ship prio
      .field(StringValue.class, 2, 2// order status
      .field(StringValue.class, 4, 10// order date
      .field(StringValue.class, 5, 8)// order prio
   
    // create DataSourceContract for LineItems input
    FileDataSource lineitems = new FileDataSource(new CsvInputFormat(), lineitemsPath, "LineItems");
    CsvInputFormat.configureRecordFormat(lineitems)
      .recordDelimiter('\n')
      .fieldDelimiter('|')
      .field(LongValue.class, 0)
      .field(DoubleValue.class, 5);

    // create MapOperator for filtering Orders tuples
    MapOperator filterO1 = MapOperator.builder(new FilterO())
      .name("FilterO")
      .input(orders1)
      .build();
    // filter configuration
    filterO1.setParameter(TPCHQuery3.YEAR_FILTER, 1993);
    filterO1.setParameter(TPCHQuery3.PRIO_FILTER, "5");
    filterO1.getCompilerHints().setFilterFactor(0.05f);
   
    // create MapOperator for filtering Orders tuples
    MapOperator filterO2 = MapOperator.builder(new FilterO())
      .name("FilterO")
      .input(orders2)
      .build();
    // filter configuration
    filterO2.setParameter(TPCHQuery3.YEAR_FILTER, 1993);
    filterO2.setParameter(TPCHQuery3.PRIO_FILTER, "5");

    // create JoinOperator for joining Orders and LineItems
    @SuppressWarnings("unchecked")
    JoinOperator joinLiO = JoinOperator.builder(new JoinLiO(), LongValue.class, 0, 0)
      .input1(filterO2, filterO1)
      .input2(lineitems)
      .name("JoinLiO")
      .build();
   
    FileDataSource partJoin1 = new FileDataSource(new CsvInputFormat(), partJoin1Path, "Part Join 1");
    CsvInputFormat.configureRecordFormat(partJoin1)
      .recordDelimiter('\n')
      .fieldDelimiter('|')
      .field(LongValue.class, 0)
      .field(IntValue.class, 1)
      .field(DoubleValue.class, 2);
   
    FileDataSource partJoin2 = new FileDataSource(new CsvInputFormat(), partJoin2Path, "Part Join 2");
    CsvInputFormat.configureRecordFormat(partJoin2)
      .recordDelimiter('\n')
      .fieldDelimiter('|')
      .field(LongValue.class, 0)
      .field(IntValue.class, 1)
View Full Code Here

    String dataInput = (args.length > 1 ? args[1] : "");
    String output = (args.length > 2 ? args[2] : "");

    @SuppressWarnings("unchecked")
    CsvInputFormat format = new CsvInputFormat(' ', IntValue.class, IntValue.class);
    FileDataSource input = new FileDataSource(format, dataInput, "Input");
   
    // create the reduce contract and sets the key to the first field
    ReduceOperator sorter = ReduceOperator.builder(new IdentityReducer(), IntValue.class, 0)
      .input(input)
      .name("Reducer")
View Full Code Here

TOP

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

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.