private Object newResult(ExpressionNode execResult, int tag) {
            if (execResult instanceof AverageAggregationResult) {
                return ((AverageAggregationResult)execResult).getAverage().getNumber();
            } else if (execResult instanceof CountAggregationResult) {
                return ((CountAggregationResult)execResult).getCount();
            } else if (execResult instanceof ExpressionCountAggregationResult) {
                long count = ((ExpressionCountAggregationResult)execResult).getEstimatedUniqueCount();
                return correctExpressionCountEstimate(count, tag);
            } else if (execResult instanceof MaxAggregationResult) {
                return ((MaxAggregationResult)execResult).getMax().getValue();
            } else if (execResult instanceof MinAggregationResult) {
                return ((MinAggregationResult)execResult).getMin().getValue();
            } else if (execResult instanceof SumAggregationResult) {
                return ((SumAggregationResult) execResult).getSum().getValue();
            } else if (execResult instanceof StandardDeviationAggregationResult) {
                return ((StandardDeviationAggregationResult) execResult).getStandardDeviation();
            } else if (execResult instanceof XorAggregationResult) {
                return ((XorAggregationResult)execResult).getXor();
            } else {
                throw new UnsupportedOperationException(execResult.getClass().getName());
            }
        }
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