August 2017
Beginner to intermediate
284 pages
6h 51m
English
As the name suggests, the partitionAggregate works on each partition instead of the whole batch. The output of partitionAggregate completely replaces the input tuple. Also, the output of partitionAggregate contains a single-field tuple. Here is a piece of code that shows how we can use partitionAggregate :
mystream.partitionAggregate(new Fields("x"), new Count() ,new new Fields("count"))
For example, we get an input stream containing the fields x and y and we apply a partitionAggregate function to each partition; the output tuples contain a single field called count. The count field represent the number of tuples presents in the input partition:
Read now
Unlock full access