Examples of generateSequence()


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

  public void testAllReduceWithCombiner() {
    try {
      ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      env.setDegreeOfParallelism(8);
     
      DataSet<Long> data = env.generateSequence(1, 8000000).name("source");
     
      GroupReduceOperator<Long, Long> reduced = data.reduceGroup(new RichGroupReduceFunction<Long, Long>() {
        public void reduce(Iterable<Long> values, Collector<Long> out) {}
      }).name("reducer");
     
View Full Code Here

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

    try {
      final int NUM_ELEMENTS = 100;
     
      ExecutionEnvironment env = new CollectionEnvironment();
     
      env.generateSequence(1, NUM_ELEMENTS)
        .map(new CountingMapper())
        .output(new DiscardingOuputFormat<Long>());
     
      JobExecutionResult result = env.execute();
     
View Full Code Here

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

    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   
    // count how many of the samples would randomly fall into
    // the unit circle
    DataSet<Long> count =
        env.generateSequence(1, numSamples)
        .map(new Sampler())
        .reduce(new SumReducer());

    // the ratio of the unit circle surface to 4 times the unit square is pi
    DataSet<Double> pi = count
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.LocalStreamEnvironment.generateSequence()

      fail();
    } catch (IllegalArgumentException e) {
    }

    try {
      env.generateSequence(-10, -30);
      fail();
    } catch (IllegalArgumentException e) {
    }

    try {
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.LocalStreamEnvironment.generateSequence()

      env.setExecutionParallelism(-10);
      fail();
    } catch (IllegalArgumentException e) {
    }
    try {
      env.generateSequence(1, 10).project(2);
      fail();
    } catch (RuntimeException e) {
    }

    try {
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.LocalStreamEnvironment.generateSequence()

  public void coTest() throws Exception {
    LocalStreamEnvironment env = StreamExecutionEnvironment
        .createLocalEnvironment(SOURCE_PARALELISM);

    DataStream<String> fromStringElements = env.fromElements("aa", "bb", "cc");
    DataStream<Long> generatedSequence = env.generateSequence(0, 3);

    fromStringElements.connect(generatedSequence).map(new CoMap()).addSink(new SetSink());

    resultSet = new HashSet<String>();
    env.executeTest(MEMORYSIZE);
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.LocalStreamEnvironment.generateSequence()

  }
 
  @Test
  public void test() throws Exception {
    LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment(1);
    env.generateSequence(1, 10).map(new IdentityMap()).filter(new FilterAll()).print();
    env.executeTest(MEMORYSIZE);
   
  }
}
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.LocalStreamEnvironment.generateSequence()

  public void outputSelectorTest() throws Exception {
   

    LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment(1);
   
    SplitDataStream<Long> source = env.generateSequence(1, 11).split(new MyOutputSelector());
    source.select(EVEN).addSink(new ListSink(EVEN));
    source.select(ODD, TEN).addSink(new ListSink(ODD_AND_TEN));
    source.select(EVEN, ODD).addSink(new ListSink(EVEN_AND_ODD));
    source.selectAll().addSink(new ListSink(ALL));
   
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.generateSequence()

    assertEquals(expectedMaxList0, MockInvokable.createAndExecute(
        new StreamReduceInvokable<Integer>(maxFunction0), simpleInput));

    StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
    try {
      env.generateSequence(1, 100).min(1);
      fail();
    } catch (Exception e) {
      // Nothing to do here
    }
    try {
View Full Code Here

Examples of org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.generateSequence()

      fail();
    } catch (Exception e) {
      // Nothing to do here
    }
    try {
      env.generateSequence(1, 100).min(2);
      fail();
    } catch (Exception e) {
      // Nothing to do here
    }
    try {
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.