Output of Date,Count_of_Type1, Count_of_Type2, Count_of_Type3 … etc
Assuming count is an integer…
1. First use SumBy to get sums for each date/type combination,
Pipe p = new SumBy(incomingPipe, new Fields("Date", "Type"), new Fields("count"), new Fields("sum"), Integer.class);
2. Then use a custom Buffer (e.g. "Pivot") to create the output that you want.
Sorting by Type simplifies the logic in Pivot
p = new GroupBy(p, new Fields("Date"), new Fields("Type"));
p = new Every(p, new Pivot(validTypes...), Fields.RESULTS);
where Pivot() would need to know the range of the "Type" field in order to output the summed counts in appropriate columns.
If you wanted to avoid having to tell Pivot what to use as "column names" then you'd need to do another operation upstream that calculates the unique set of values, which works (at the cost of another job, and some fun joining that in).
I've got the start of a general Pivot() subassembly (in Java), but it's not done yet.
-- Ken
--------------------------