druidry
druidry copied to clipboard
In the examples, there is a bug around creating `DruidTopNQuery`
@GG-Zapr
In the examples, there is a bug. When creating the DruidTopNQuery
object, need to set the datasource
. But it shouldn't be the String
type. How can fix it?
Hey @joybee-pp
Thanks for pointing this out, we need to update README for fixing this example. Previously dataSource was simply String
but now with druid supporting multiple type of data sources now datSource is an object of in.zapr.druid.druidry.dataSource.DataSource
.
To achieve top N query like example, you could use TableDataSource
like :
DruidTopNQuery query = DruidTopNQuery.builder()
.dataSource(new TableDataSource("sample_data"))
.dimension(dimension)
.threshold(5)
.topNMetric(metric)
.granularity(granularity)
.filter(filter)
.aggregators(Arrays.asList(aggregator1, aggregator2))
.postAggregators(Collections.singletonList(postAggregator))
.intervals(Collections.singletonList(interval))
.build();