private void mergeGroupingMaps(Map<Integer, Grouping> state, Map<Integer, Grouping> result) {
        for (Grouping grouping : result.values()) {
            Grouping old = state.get(grouping.getId());
            if (old != null) {
                old.merge(grouping);
                // no need to invoke postMerge, as state is empty for
                // current level
            } else {
                log.warning("Got grouping result with unknown id: " + grouping);
            }
        }
    }
Merges the content of result into state. This needs to be done in order to conserve the context objects contained
in the state as they are not part of the serialized object representation.

@param state  the current state
@param result the results from the current pass
container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java