How do I get the DataSketches Theta Sketch Aggregator to return integers?

So I use Theta Sketches Aggregators to count users in my druid native queries. Here’s an example query:

  {
    dataSource: 'datasource',
    granularity: 'all',
    aggregations: [
      {
        type: 'thetaSketch',
        name: 'users',
        fieldName: 'clientUser',
      },
    ],
    queryType: 'timeseries',
    intervals: [...],
  }

The theta sketches aggregator seems to return numbers with decimal places a lot of the time, especially with large datasets – but I’d really like it to return integers. I assume that this is a side effect of how the theta sketch algorithm works, but is there an easy way to round them down or up?

1 Like

Hi Daniel,

I believe you can use ROUND function in a post-aggregation step.

1 Like

Amazing, thank you very much! :slight_smile:

1 Like