private long correctExpressionCountEstimate(long count, int tag) {
            int actualGroupCount = group.getNumChildren();
            // Use actual group count if estimate differ. If max is present, only use actual group count if less than max.
            // NOTE: If the actual group count is 0, estimate is also 0.
            if (actualGroupCount > 0 && count != actualGroupCount) {
                if (transform.getMax(tag + 1) == 0 || transform.getMax(tag + 1) > actualGroupCount) {
                    return actualGroupCount;
                }
            }
            return count;
        }
Constructs the grouping result tree that corresponds to the parameters given to this builder. This method might
fail due to unsupported constructs in the results, in which case an exception is thrown.

@throws IllegalInputException Thrown if the grouping result contains unsupported constructs.
container-search/src/main/java/com/yahoo/search/grouping/vespa/ResultBuilder.java