thrownewNullPointerException("Reduce function must not be null.")
}
newDataStream[T](javaStream.reduce(reducer))
}
/**
* Applies a reduce transformation on the windowed data stream by reducing
* the current window at every trigger.
*
*/
defreduce(fun:(T,T)=>T):DataStream[T]={
if(fun==null){
thrownewNullPointerException("Reduce function must not be null.")
}
valreducer=newReduceFunction[T]{
valcleanFun=clean(fun)
defreduce(v1:T,v2:T)={cleanFun(v1,v2)}
}
reduce(reducer)
}
/**
* Applies a reduceGroup transformation on the windowed data stream by reducing
* the current window at every trigger. In contrast with the simple binary reduce operator, groupReduce exposes the whole window through the Iterable interface.
* </br>
* </br>
* Whenever possible try to use reduce instead of groupReduce for increased efficiency
* Applies a reduceGroup transformation on the windowed data stream by reducing
* the current window at every trigger. In contrast with the simple binary reduce operator, groupReduce exposes the whole window through the Iterable interface.
* </br>
* </br>
* Whenever possible try to use reduce instead of groupReduce for increased efficiency