private void assertBrokerResponse(int numSegments, BrokerResponse brokerResponse)
      throws JSONException {
    Assert.assertEquals(10001 * numSegments, brokerResponse.getNumDocsScanned());
    Assert.assertEquals(_numAggregations, brokerResponse.getAggregationResults().size());
    for (int i = 0; i < _numAggregations; ++i) {
      Assert.assertEquals(
          "[\"column11\",\"column10\"]",
          brokerResponse.getAggregationResults().get(i).getJSONArray("groupByColumns").toString());
      Assert.assertEquals(
          15, brokerResponse.getAggregationResults().get(i).getJSONArray("groupByResult").length());
    }

    // Assertion on Count
    assertionOnCount(brokerResponse);

    // Assertion on Aggregation Results
    LOGGER.info("brokerResponse = {}", brokerResponse);
    final List<double[]> aggregationResult = getAggregationResult(numSegments);
    final List<String[]> groupByResult = getGroupResult();
    for (int j = 0; j < _numAggregations; ++j) {
      final double[] aggResult = aggregationResult.get(j);
      final String[] groupResult = groupByResult.get(j);
      for (int i = 0; i < 15; ++i) {
        Assert.assertEquals(
            0,
            DoubleComparisonUtil.defaultDoubleCompare(
                aggResult[i],
                brokerResponse
                    .getAggregationResults()
                    .get(j)
                    .getJSONArray("groupByResult")
                    .getJSONObject(i)
                    .getDouble("value")));
        if ((i < 14 && aggResult[i] == aggResult[i + 1])
            || (i > 0 && aggResult[i] == aggResult[i - 1])) {
          // do nothing, as we have multiple groups within same value.
        } else {
          Assert.assertEquals(
              groupResult[i],
              brokerResponse
                  .getAggregationResults()
                  .get(j)
                  .getJSONArray("groupByResult")
                  .getJSONObject(i)
                  .getString("group"));
        }
      }
    }
  }
  private void assertBrokerResponse(int numSegments, BrokerResponse brokerResponse)
      throws JSONException {
    Assert.assertEquals(10001 * numSegments, brokerResponse.getNumDocsScanned());
    final int groupSize = 15;
    assertBrokerResponse(brokerResponse, groupSize);

    // Assertion on Aggregation Results
    final List<double[]> aggregationResult = getAggregationResult(numSegments);
    final List<String[]> groupByResult = getGroupResult();
    for (int j = 0; j < _numAggregations; ++j) {
      final double[] aggResult = aggregationResult.get(j);
      final String[] groupResult = groupByResult.get(j);
      for (int i = 0; i < 15; ++i) {
        Assert.assertEquals(
            0,
            DoubleComparisonUtil.defaultDoubleCompare(
                aggResult[i],
                brokerResponse
                    .getAggregationResults()
                    .get(j)
                    .getJSONArray("groupByResult")
                    .getJSONObject(i)
                    .getDouble("value")));
        if ((i < 14 && aggResult[i] == aggResult[i + 1])
            || (i > 0 && aggResult[i] == aggResult[i - 1])) {
          // do nothing, as we have multiple groups within same value.
        } else {
          Assert.assertEquals(
              groupResult[i],
              brokerResponse
                  .getAggregationResults()
                  .get(j)
                  .getJSONArray("groupByResult")
                  .getJSONObject(i)
                  .getString("group"));
        }
      }
    }
  }