Hi TD
Could you explain me this code part?

.reduceByKeyAndWindow(
109         new Function2<Integer, Integer, Integer>() {
110 public Integer call(Integer i1, Integer i2) { return i1 + i2; }
111         },
112         new Function2<Integer, Integer, Integer>() {
113 public Integer call(Integer i1, Integer i2) { return i1 - i2; }
114         },
115 new Duration(60 * 5 * 1000),
116         new Duration(1 * 1000)
117       );

Thanks

Em 4/4/14, 22:56, Tathagata Das escreveu:
I havent really compiled the code, but it looks good to me. Why? Is there any problem you are facing?

TD


On Fri, Apr 4, 2014 at 8:03 AM, Eduardo Costa Alfaia <e.costaalf...@unibs.it <mailto:e.costaalf...@unibs.it>> wrote:


    Hi guys,

    I would like knowing if the part of code is right to use in Window.

    JavaPairDStream<String, Integer> wordCounts = words.map(
    103       new PairFunction<String, String, Integer>() {
    104         @Override
    105         public Tuple2<String, Integer> call(String s) {
    106           return new Tuple2<String, Integer>(s, 1);
    107         }
    108       }).reduceByKeyAndWindow(
    109         new Function2<Integer, Integer, Integer>() {
    110           public Integer call(Integer i1, Integer i2) { return
    i1 + i2; }
    111         },
    112         new Function2<Integer, Integer, Integer>() {
    113           public Integer call(Integer i1, Integer i2) { return
    i1 - i2; }
    114         },
    115         new Duration(60 * 5 * 1000),
    116         new Duration(1 * 1000)
    117       );



    Thanks

-- Informativa sulla Privacy: http://www.unibs.it/node/8155




--
Informativa sulla Privacy: http://www.unibs.it/node/8155

Reply via email to