Description
TheMap combinator can be applied to the max
function to calculate the maximum value in a Map according to each key, using the maxMap
aggregate combinator function.
Example usage
In this example, weโll create a table that stores status codes and their counts for different timeslots, where each row contains a Map of status codes to their corresponding counts. Weโll usemaxMap to find the maximum count for each status code within each timeslot.
Query
maxMap function will find the maximum count for each status code within each timeslot. For example:
- In timeslot โ2000-01-01 00:00:00โ:
- Status โaโ: 15
- Status โbโ: 25
- Status โcโ: max(35, 45) = 45
- Status โdโ: 55
- Status โeโ: 65
- In timeslot โ2000-01-01 00:01:00โ:
- Status โdโ: 75
- Status โeโ: 85
- Status โfโ: max(95, 105) = 105
- Status โgโ: max(115, 125) = 125
Response