I got around that limitation. I implemented a variant of MapCombinerAggStateUpdater that accepts multiple fields as input and output, executes a separate combiner aggregator for each input field, and stored all updated fields as a single list into the map.
Then, I use it similarly to what persistentAggregate() does, e.g. for summing 2 fields:
.chainedAgg()
.aggregate(new Fields(inputField1), new Sum(), new Fields(outputField1))
.aggregate(new Fields(inputField2), new Sum(), new Fields(outputField2))
.chainEnd()
.partitionPersist(
new StateSpec(new MyMapFactory<List<Long>>(...)),
TridentUtils.fieldsUnion(groupFields, new Fields(outputField1, outputField2),
new MyMapUpdater(..., new Sum(), new Sum()),
TridentUtils.fieldsConcat(groupFields, new Fields(outputField1, outputField2)));
That works well. All the fields are aggregated for each group key in a single get-update-put cycle.
So I'd suggest doing something similar: implementing a variant of MapCombinerAggStateUpdater that stores lists, and a variant of persistentAggregate() to uses that, like my pseudo-code above.
I think that would have value e.g. for users storing multiple aggregate fields in a single SQL table, one value per table.
Regards,
--
Romain Lenglet