ing-bank / scruid

Scala + Druid: Scruid. A library that allows you to compose queries in Scala, and parse the result back into typesafe classes.
Apache License 2.0
115 stars 29 forks source link

Implementation of Javascript aggregator for DQL #72

Closed utk14 closed 4 years ago

utk14 commented 4 years ago

Hi I am working on the DQL and I am facing difficulty with how to implement the javascript aggregator for the druid query language.

anskarl commented 4 years ago

I've prepared an update in order add support for Javascript aggregators in Scruid.

To pass the tests, it requires a Druid server with Javascript support enabled. @Fokko I've made a PR in https://github.com/Fokko/docker-druid/pull/3 in order to have a docker image with Javascript support enabled.

Fokko commented 4 years ago

@anskarl Thanks for the PR, I've merged it 👍

anskarl commented 4 years ago

thanks! @Fokko once you update the druid-docker image in docker-hub I will make a PR for the Javascript aggregator

Fokko commented 4 years ago

My pleasure @anskarl. Looking forward to the aggregator.

utk14 commented 4 years ago

@anskarl Is there the implementation of javascript post aggregator for DQL?

anskarl commented 4 years ago

@anskarl Is there the implementation of javascript post aggregator for DQL?

@utk14 the implementation is in the pull request https://github.com/ing-bank/scruid/pull/77

An example can be found in docs https://github.com/anskarl/scruid/blob/feature/js_aggregation/docs/dql.md#javascript-aggregator

utk14 commented 4 years ago

@anskarl If I am not wrong your PR is for JavascriptAggregator.. I wanted to know whether there is any implementation for javascriptPostAggregator.

I want to implement something similar to Druid's javascript post aggregator (https://druid.apache.org/docs/latest/querying/post-aggregations.html):

{
  "type": "javascript",
  "name": "absPercent",
  "fieldNames": ["delta", "total"],
  "function": "function(delta, total) { return 100 * Math.abs(delta) / total; }"
}
anskarl commented 4 years ago

You are right @utk14, I've updated the PR with Javascript post-aggregator in DQL.

utk14 commented 4 years ago

@anskarl Thanks for the help. Is your PR merged?

anskarl commented 4 years ago

I think the issue can be closed, since the corresponding PR has been merged to the master branch

Fokko commented 4 years ago

Thank you for the update @anskarl. By any chance @utk14, did you find an opportunity to test the aggregator?

utk14 commented 4 years ago

@Fokko Yeah It worked perfectly.. Please let me know when will you release the maven dependency with the latest changes?

Fokko commented 4 years ago

Awesome, great to hear. @mmartina any plan for a release? :-)

utk14 commented 4 years ago

Hi @Fokko any updates when you are planning to release the maven version?

mmartina commented 4 years ago

v2.3.0 released.