Skip to main content
Skip to main content

sumMap

Description

The Map combinator can be applied to the sum function to calculate the sum of values in a Map according to each key, using the sumMap 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 use sumMap to calculate the total count for each status code within each timeslot.

The sumMap function will calculate the total 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': 35 + 45 = 80
    • Status 'd': 55
    • Status 'e': 65
  • In timeslot '2000-01-01 00:01:00':
    • Status 'd': 75
    • Status 'e': 85
    • Status 'f': 95 + 105 = 200
    • Status 'g': 115 + 125 = 240

See also