From the trident API page it says
A function takes in a set of input fields and emits zero or more tuples as output. The fields of the output tuple are appended to the original input tuple in the stream. If a function emits no tuples, the original input tuple is filtered out. Otherwise, the input tuple is duplicated for each output tuple
Now digging more from the trident tutorial page found this
With grouped streams, the output will contain the grouping fields followed by the fields emitted by the aggregator. For example:
stream.groupBy(new Fields("val1"))
.aggregate(new Fields("val2"), new Sum(), new Fields("sum"))
In this example, the output will contain the fields "val1" and "sum"
.
I am not sure but the closest one I can think of is doing something like
stream.groupBy(new Fields("field1","field3","field4"))
.aggregate(new Fields("field2"), new Sum(), new Fields("M_field2"))
might achieve what you are looking for. Correct me if I am wrong.