class AnswerMetadataUtil {

  @VisibleForTesting
  @Nullable
  static ColumnAggregationResult computeColumnAggregation(
      @Nonnull TableAnswerElement table,
      @Nonnull ColumnAggregation columnAggregation,
      @Nonnull BatfishLogger logger) {
    Object value;
    String column = columnAggregation.getColumn();
    Aggregation aggregation = columnAggregation.getAggregation();
    switch (aggregation) {
      case MAX:
        value = computeColumnMax(table, column, logger);
        break;
      default:
        String message = String.format("Unhandled aggregation type: %s", aggregation);
        logger.errorf("%s\n", message);
        throw new IllegalArgumentException(message);
    }
    return value == null ? null : new ColumnAggregationResult(aggregation, column, value);
  }

  private  AnswerMetadataUtil();

}