grafadruid/druid-grafana

Unsupported aggregation type on JSON query

Opened this issue · 5 comments

I use Tuple Sketches on my datasource and as such I need to use the appropriate aggregation on the query. Those aggregations are not available on the query builder, so it looks like the JSON option would allow me to write the entire query by hand since it is using something that the query builder doesn't know about.

But then, the JSON query is parsed only for known aggregation types. This makes absolutely no sense.
Druid supports plugins, if I create a new interleaveDigits aggregation I should be able to use it. The go-druid library can't possibly know about every Druid extension both public and private in every company.

The JSON queries should just be interpolated with the interval variables and sent to Druid without going through the builder at all or, if go-druid actually aims to be compatible with everything, it should accept any unknown aggregation and post aggregation as a map[string]any instead of returning an error.

Hello @Fryuni
Thank you for your bright feedback; which, not like this project, makes total sense :)
Being in a hurry, you can already use the SQL query type and profit from any plugin you want.
If you want to go the JSON query way, then since we do use the builder pattern, the best would probably be to contribute your plugin of choice support.
If you want to spend a bit more time to make the builders (front-end & back-end) able to fallback to direct query when unable to support the query then I'll be happy to help you all the way long!
On my side, I have no time and will to make such a change.

Being in a hurry, you can already use the SQL query type and profit from any plugin you want.

Some aggregations are only available on the native JSON query, like those for Tuple Sketches

If you want to spend a bit more time to make the builders (front-end & back-end) able to fallback to direct query when unable to support the query then I'll be happy to help you all the way long!

I can make the backend support arbitrary aggregations from the JSON editor, but the frontend builder is a complete mystery for me. But I can try.

I'll start with a PR on go-druid first.

@jbguerraz I opened the PR on the library: grafadruid/go-druid#83

and merged @Fryuni ! :) thx a lot!

Fryuni commented

Great, so updating the library here should already enable custom queries.
The query builder still needs to be changed to allow creating values of custom types.