[
  {
    "description": "timeseries, 1 agg, all",
    "query": {
      "queryType": "timeBoundary",
      "dataSource": "%%DATASOURCE%%"
    },
    "expectedResults": [
      {
        "timestamp": "2013-08-31T01:02:33.000Z",
        "result": {
          "minTime": "2013-08-31T01:02:33.000Z",
          "maxTime": "2013-09-01T18:22:39.000Z"
        }
      }
    ]
  },
  {
    "description": "timeseries, datasketch aggs, all",
    "query": {
      "queryType": "timeseries",
      "dataSource": "%%DATASOURCE%%",
      "granularity": "day",
      "intervals": [
        "2013-09-01T00:00/2013-09-02T00:00"
      ],
      "filter": null,
      "aggregations": [
        {
          "type": "HLLSketchMerge",
          "name": "approxCountHLL",
          "fieldName": "HLLSketchBuild",
          "lgK": 12,
          "tgtHllType": "HLL_4",
          "round": true
        },
        {
          "type": "thetaSketch",
          "name": "approxCountTheta",
          "fieldName": "thetaSketch",
          "size": 16384,
          "shouldFinalize": true,
          "isInputThetaSketch": false,
          "errorBoundsStdDev": null
        },
        {
          "type": "quantilesDoublesSketch",
          "name": "quantilesSketch",
          "fieldName": "quantilesDoublesSketch",
          "k": 128
        }
      ]
    },
    "expectedResults": [
      {
        "timestamp": "2013-09-01T00:00:00.000Z",
        "result": {
          "quantilesSketch": 6,
          "approxCountTheta": 6.0,
          "approxCountHLL": 6
        }
      }
    ]
  },
  {
    "description": "having spec on post aggregation",
    "query": {
      "queryType": "groupBy",
      "dataSource": "%%DATASOURCE%%",
      "granularity": "day",
      "dimensions": [
        "page"
      ],
      "filter": {
        "type": "selector",
        "dimension": "language",
        "value": "zh"
      },
      "aggregations": [
        {
          "type": "count",
          "name": "rows"
        },
        {
          "type": "longSum",
          "fieldName": "added",
          "name": "added_count"
        }
      ],
      "postAggregations": [
        {
          "type": "arithmetic",
          "name": "added_count_times_ten",
          "fn": "*",
          "fields": [
            {
              "type": "fieldAccess",
              "name": "added_count",
              "fieldName": "added_count"
            },
            {
              "type": "constant",
              "name": "const",
              "value": 10
            }
          ]
        }
      ],
      "having": {
        "type": "greaterThan",
        "aggregation": "added_count_times_ten",
        "value": 9000
      },
      "intervals": [
        "2013-08-31T00:00/2013-09-01T00:00"
      ]
    },
    "expectedResults": [
      {
        "version": "v1",
        "timestamp": "2013-08-31T00:00:00.000Z",
        "event": {
          "added_count_times_ten": 9050.0,
          "page": "Crimson Typhoon",
          "added_count": 905,
          "rows": 1
        }
      },
      {
        "version": "v1",
        "timestamp": "2013-08-31T00:00:00.000Z",
        "event": {
          "added_count_times_ten": 9770.0,
          "page": "Gypsy Danger",
          "added_count": 977,
          "rows": 1
        }
      }
    ]
  }
]