Database Reference
In-Depth Information
mystream.each(new Fields("b", "a"), new
MyLocalFilterFunction())
The output would be as follows:
//for tuple 1 [1,2,3]
// no output because valueof("field b") ==1 &&
valueof("field a") ==2 //is not satisfied
//for tuple 1 [2,1,1]
// no output because valueof("field b") ==1 &&
valueof("field a") ==2 [2,1,1]
//for tuple 1 [2,3,4]
// no output because valueof("field b") ==1 &&
valueof("field a") ==2 //is not satisfied
partitionAggregate
The partitionAggregate function on each of the partitions over a set of tuples
clubbed together as a batch. There is a behavioral difference between this function; com-
pared to local functions that we have executed so far, this one emits a single output tuple
for the stream on input tuples.
The following are other functions that can be used for various aggregates that can be ex-
ecuted over this framework.
Sum aggregate
Here is how the call is made to the sum aggregator function:
mystream.partitionAggregate(new Fields("b"), new Sum(), new
Fields("sum"))
Let's assume the input stream has the ["a", "b"] fields, and the following are the
tuples:
Partition 0:
["a", 1]
["b", 2]
Partition 1:
["a", 3]
Search WWH ::




Custom Search