使用分位数数据草图聚合器时,来自德鲁伊的空响应

时间:2020-06-02 12:34:45

标签: druid

我正在尝试计算德鲁伊中度量标准的第95个百分位数。我碰到了这个文档https://druid.apache.org/docs/latest/development/extensions-core/datasketches-quantiles.html,该文档说我们可以在查询时从原始数据构建草图。

我准备了这个德鲁伊查询

{
    "queryType": "timeseries",
    "intervals": [
        "2020-05-08T11:45:00.000Z/2020-05-08T11:50:00.000Z"
    ],
    "granularity": "minute",
    "dataSource": "datasource",
    "filter": {
        "type": "selector",
        "dimension": "hostName",
        "value": "host"
    },
    "postAggregation": [
        {
            "type": "quantilesDoublesSketchToQuantile",
            "name": "dim",
            "field": "dim",
            "fraction": 0.5
        }
    ]
}

但是,当我触发此查询时,我从druid收到了空响应。输出是

[
  {
    "timestamp": "2020-05-08T11:45:00.000Z",
    "result": {

    }
  },
  {
    "timestamp": "2020-05-08T11:46:00.000Z",
    "result": {

    }
  },
  {
    "timestamp": "2020-05-08T11:47:00.000Z",
    "result": {

    }
  },
  {
    "timestamp": "2020-05-08T11:48:00.000Z",
    "result": {

    }
  },
  {
    "timestamp": "2020-05-08T11:49:00.000Z",
    "result": {

    }
  }
]

我验证了在该时间范围内德鲁伊中存在数据。预先感谢

1 个答案:

答案 0 :(得分:0)

您有一个postAggregator类型的quantilesDoublesSketchToQuantile,您正在传递字段dim。该函数获取草图并将其汇总后转换为分位数,但它不会构建草图,而是希望将草图作为输入。首先,您需要使用函数quantilesDoublesSketch创建一个聚合,在其中传递dim,然后可以使用生成postAggregator的草图。

相关问题