Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the examples, there is a bug around creating DruidTopNQuery #149

Open
joybee-pp opened this issue Aug 3, 2020 · 1 comment
Open

In the examples, there is a bug around creating DruidTopNQuery #149

joybee-pp opened this issue Aug 3, 2020 · 1 comment

Comments

@joybee-pp
Copy link

joybee-pp commented Aug 3, 2020

Screen Shot 2020-08-03 at 12 46 12

@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?

@abhi-zapr
Copy link
Contributor

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants