support multiple calculations in a single query

to reduce code duplication of looping over the multiple operations, execute_simple_calculation and execute_grouped_calculation were combined. calculating and selecting on the group is skipped by an if in the function, and the final loop short-circuits out of constructing the hash for the simple case by just returning