I have a dataset "events" that includes an array of maps. I want to turn it into one map which is the aggregation of the amounts and counts
Currently, I'm running the following statement:
events.select(functions.col(“totalAmounts)).collectAsList()
which returns the following:
[
[
Map(totalCreditAmount -> 10, totalDebitAmount -> 50)
],
[
Map(totalCreditAmount -> 50, totalDebitAmount -> 100)
]
]
I want to aggregate the amounts and counts and have it return:
[
Map(totalCreditAmount -> 60, totalDebitAmount -> 150)
]