Package eu.stratosphere.api.java

Examples of eu.stratosphere.api.java.ExecutionEnvironment.execute()


    DataSet<MyUser> input = env.createInput(new AvroInputFormat<MyUser>(new Path(inputPath), MyUser.class));
 
    DataSet<Tuple2<String, MyUser>> result = input.map(new NameExtractor()).groupBy(0).reduce(new NameGrouper());
   
    result.output(new DiscardingOuputFormat<Tuple2<String,MyUser>>());
    env.execute();
  }
}
View Full Code Here


    source.output(JDBCOutputFormat.buildJDBCOutputFormat()
        .setDrivername("org.apache.derby.jdbc.EmbeddedDriver")
        .setDBUrl("jdbc:derby:memory:ebookshop")
        .setQuery("insert into newbooks (id,title,author,price,qty) values (?,?,?,?,?)")
        .finish());
    environment.execute();
  }

  private static void prepareTestDb() throws Exception {
    String dbURL = "jdbc:derby:memory:ebookshop;create=true";
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
View Full Code Here

    DataSet<String> text = env.fromElements(WordCountData.TEXT);
    DataSet<Tuple2<String, Integer>> words = text.flatMap(new WordCount.Tokenizer());
    DataSet<Tuple2<String, Integer>> result = words.groupBy(0).aggregate(Aggregations.SUM, 1);

    result.output(new LocalCollectionOutputFormat<Tuple2<String, Integer>>(resultsCollected));
    env.execute("Word Count Collection");
  }
}
View Full Code Here

    DataSet<Tuple2<Long, Long>> initialVertices = vertexIds.map(new IdAssigner());
   
    DataSet<Tuple2<Long, Long>> result = initialVertices.runOperation(VertexCentricIteration.withPlainEdges(edges, new CCUpdater(), new CCMessager(), 100));
   
    result.print();
    env.execute("Spargel Connected Components");
  }
 
  public static final class CCUpdater extends VertexUpdateFunction<Long, Long, Long> {
    @Override
    public void updateVertex(Long vertexKey, Long vertexValue, MessageIterator<Long> inMessages) {
View Full Code Here

   
   
    DataSet<Tuple2<Long, Double>> result = intialRanks.runOperation(iteration);
   
    result.print();
    env.execute("Spargel PageRank");
  }
 
  /**
   * Function that updates the rank of a vertex by summing up the partial ranks from all incoming messages
   * and then applying the dampening formula.
View Full Code Here

        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple2<Integer, String>> crossDs = ds.cross(ds2).with(new Tuple5Cross());
       
        crossDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "0,HalloHallo\n" +
            "1,HalloHallo Welt\n" +
            "2,HalloHallo Welt wie\n" +
View Full Code Here

        DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.getSmall3TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple3<Integer, Long, String>> crossDs = ds.cross(ds2).with(new Tuple3ReturnLeft());
       
        crossDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "1,1,Hi\n" +
            "1,1,Hi\n" +
            "1,1,Hi\n" +
View Full Code Here

        DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.getSmall3TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> crossDs = ds.cross(ds2).with(new Tuple5ReturnRight());
       
        crossDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "1,1,0,Hallo,1\n" +
            "1,1,0,Hallo,1\n" +
            "1,1,0,Hallo,1\n" +
View Full Code Here

        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple3<Integer, Integer, Integer>> crossDs = ds.cross(ds2).with(new Tuple5CrossBC()).withBroadcastSet(intDs, "ints");
       
        crossDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "2,0,55\n" +
            "3,0,55\n" +
            "3,0,55\n" +
View Full Code Here

        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
        DataSet<Tuple2<Integer, String>> crossDs = ds.crossWithHuge(ds2).with(new Tuple5Cross());
       
        crossDs.writeAsCsv(resultPath);
        env.execute();
       
        // return expected result
        return "0,HalloHallo\n" +
            "1,HalloHallo Welt\n" +
            "2,HalloHallo Welt wie\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.