@Test
  public void testIngestAndQuery() throws Exception {
    AggregationTestHelper helper =
        AggregationTestHelper.createGroupByQueryAggregationTestHelper(
            Lists.newArrayList(new AggregatorsModule()), tempFolder);

    String metricSpec =
        "[{"
            + "\"type\": \"hyperUnique\","
            + "\"name\": \"index_hll\","
            + "\"fieldName\": \"market\""
            + "}]";

    String parseSpec =
        "{"
            + "\"type\" : \"string\","
            + "\"parseSpec\" : {"
            + "    \"format\" : \"tsv\","
            + "    \"timestampSpec\" : {"
            + "        \"column\" : \"timestamp\","
            + "        \"format\" : \"auto\""
            + "},"
            + "    \"dimensionsSpec\" : {"
            + "        \"dimensions\": [],"
            + "        \"dimensionExclusions\" : [],"
            + "        \"spatialDimensions\" : []"
            + "    },"
            + "    \"columns\": [\"timestamp\", \"market\", \"quality\", \"placement\", \"placementish\", \"index\"]"
            + "  }"
            + "}";

    String query =
        "{"
            + "\"queryType\": \"groupBy\","
            + "\"dataSource\": \"test_datasource\","
            + "\"granularity\": \"ALL\","
            + "\"dimensions\": [],"
            + "\"aggregations\": ["
            + "  { \"type\": \"hyperUnique\", \"name\": \"index_hll\", \"fieldName\": \"index_hll\" }"
            + "],"
            + "\"postAggregations\": ["
            + "  { \"type\": \"hyperUniqueCardinality\", \"name\": \"index_unique_count\", \"fieldName\": \"index_hll\" }"
            + "],"
            + "\"intervals\": [ \"1970/2050\" ]"
            + "}";

    Sequence seq =
        helper.createIndexAndRunQueryOnSegment(
            new File(this.getClass().getClassLoader().getResource("druid.sample.tsv").getFile()),
            parseSpec,
            metricSpec,
            0,
            QueryGranularities.NONE,
            50000,
            query);

    MapBasedRow row = (MapBasedRow) Sequences.toList(seq, Lists.newArrayList()).get(0);
    Assert.assertEquals(3.0, row.getFloatMetric("index_hll"), 0.1);
    Assert.assertEquals(3.0, row.getFloatMetric("index_unique_count"), 0.1);
  }