Package org.apache.flink.streaming.util.keys

Examples of org.apache.flink.streaming.util.keys.FieldsKeySelector


          @Override
          public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1,
              Tuple2<String, Integer> value2) throws Exception {
            return new Tuple2<String, Integer>(value1.f0, value1.f1 + value2.f1);
          }
        }, 2, 3, new FieldsKeySelector(true, false, 0),
        new TimeStamp<Tuple2<String, Integer>>() {
          private static final long serialVersionUID = 1L;

          @Override
          public long getTimestamp(Tuple2<String, Integer> value) {
View Full Code Here


              outTuple.f0 = value.f0;
              outTuple.f1 += value.f1;
            }
            out.collect(outTuple);
          }
        }, 2, 3, new FieldsKeySelector(true, false, 0),
        new TimeStamp<Tuple2<String, Integer>>() {
          private static final long serialVersionUID = 1L;

          @Override
          public long getTimestamp(Tuple2<String, Integer> value) {
View Full Code Here

    Tuple2<Integer, Integer> int3 = new Tuple2<Integer, Integer>(0, 3);
    Tuple2<Integer, Integer> int4 = new Tuple2<Integer, Integer>(2, 4);
    Tuple2<Integer, Integer> int5 = new Tuple2<Integer, Integer>(1, 5);

    CoGroupedReduceInvokable<Tuple3<String, String, String>, Tuple2<Integer, Integer>, String> invokable = new CoGroupedReduceInvokable<Tuple3<String, String, String>, Tuple2<Integer, Integer>, String>(
        new MyCoReduceFunction(), new FieldsKeySelector(true, false, 0),
        new FieldsKeySelector(true, false, 0));

    List<String> expected = Arrays.asList("word1", "1", "word2", "2", "word1word3", "3", "5",
        "7");

    List<String> actualList = MockCoInvokable.createAndExecute(invokable,
        Arrays.asList(word1, word2, word3), Arrays.asList(int1, int2, int3, int4, int5));

    assertEquals(expected, actualList);

    invokable = new CoGroupedReduceInvokable<Tuple3<String, String, String>, Tuple2<Integer, Integer>, String>(
        new MyCoReduceFunction(), new FieldsKeySelector(true, false, 2),
        new FieldsKeySelector(true, false, 0));

    expected = Arrays.asList("word1", "1", "word2", "2", "word2word3", "3", "5", "7");

    actualList = MockCoInvokable.createAndExecute(invokable,
        Arrays.asList(word1, word2, word3), Arrays.asList(int1, int2, int3, int4, int5));
View Full Code Here

    expected.add("g");
    expected.add("fh");
    expected.add("i");

    CoGroupedWindowReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String> invokable = new CoGroupedWindowReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String>(
        new MyCoReduceFunction(), 4L, 3L, 4L, 3L, new FieldsKeySelector(true, false, 0),
        new FieldsKeySelector(true, false, 0), new MyTimeStamp<Tuple2<String, Integer>>(
            timestamps1), new MyTimeStamp<Tuple2<String, String>>(timestamps2));

    List<String> result = MockCoInvokable.createAndExecute(invokable, inputs1, inputs2);

    Collections.sort(result);
View Full Code Here

    expected.add("bdf");
    expected.add("egi");
    expected.add("fh");

    CoGroupedWindowReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String> invokable = new CoGroupedWindowReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String>(
        new MyCoReduceFunction(), 4L, 3L, 2L, 2L, new FieldsKeySelector(true, false, 0),
        new FieldsKeySelector(true, false, 0), new MyTimeStamp<Tuple2<String, Integer>>(
            timestamps1), new MyTimeStamp<Tuple2<String, String>>(timestamps2));

    List<String> result = MockCoInvokable.createAndExecute(invokable, inputs1, inputs2);

    Collections.sort(result);
View Full Code Here

    expected.add("gi");
    expected.add("bdf");
    expected.add("h");

    CoGroupedBatchReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String> invokable = new CoGroupedBatchReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String>(
        new MyCoReduceFunction(), 4L, 3L, 4L, 3L, new FieldsKeySelector(true, false, 0),
        new FieldsKeySelector(true, false, 0));

    List<String> result = MockCoInvokable.createAndExecute(invokable, inputs1, inputs2);

    Collections.sort(result);
    Collections.sort(expected);
View Full Code Here

    expected.add("egi");
    expected.add("bdf");
    expected.add("fh");

    CoGroupedBatchReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String> invokable = new CoGroupedBatchReduceInvokable<Tuple2<String, Integer>, Tuple2<String, String>, String>(
        new MyCoReduceFunction(), 4L, 3L, 2L, 2L, new FieldsKeySelector(true, false, 0),
        new FieldsKeySelector(true, false, 0));

    List<String> result = MockCoInvokable.createAndExecute(invokable, inputs1, inputs2);

    Collections.sort(result);
    Collections.sort(expected);
View Full Code Here

TOP

Related Classes of org.apache.flink.streaming.util.keys.FieldsKeySelector

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.