September 2017
Beginner to intermediate
360 pages
8h 13m
English
Partition aggregate runs a function on each partition of a batch of tuples. The output of the partition aggregate contains a single field tuple. The following is the example:
stream.partitionAggregate(new Fields("b"), new Sum(), new Fields("sum"))
Let's say the input is as follows:
Partition 0:["a", 1]["b", 2]Partition 1:["a", 3]["c", 8]Partition 2:["e", 1]["d", 9]["d", 10]
The output would be:
Partition 0:[3]Partition 1:[11]Partition 2:[20]
Read now
Unlock full access