I'm developing a storage plugin for OpenTSDB available here
https://github.com/mapr-demos/drill .
I have solved many problems of adopting Drill syntax to TSDB syntax.
And I have only one question: is there any way to overwrite default
functionality of aggregation functions in drill ?
So there is select avg|sum|min|max value)... such aggregation functions from
SQL. Drill has more than that. So I want make custom
aggregators and otherride existing. Existing way in not " propersql" style and
I want to change this.
now I support such queries:
*
SELECT * FROM openTSDB.`warp.speed.test`
* Return all elements from `warp.speed.test` table with default
aggregator SUM
*
SELECT * FROM openTSDB.`(metric=warp.speed.test)`
* Return all elements from `(metric=warp.speed.test)` table as a
previous query, but with alternative FROM syntax
*
SELECT * FROM openTSDB.`(metric=warp.speed.test, aggregator=avg)`
* Return all elements from `warp.speed.test` table, but with the custom
aggregator
*
SELECT `timestamp`, sum(`aggregated value`) FROM
openTSDB.`(metric=warp.speed.test, aggregator=avg)` GROUP BY `timestamp`
* Return aggregated and grouped value by standard drill functions from
`warp.speed.test` table, but with the custom aggregator
*
SELECT * FROM openTSDB.`(metric=warp.speed.test, downsample=5m-avg )`
* Return data limited by downsample
You can see more information here
https://github.com/mapr-demos/drill-opentsdb/wiki
As I understand there is no predefined way to do this. I'm not familiar with
drill core, so I'm asking for help.
Now I am resolving all syntax problems in "from" clause and "where" clause.
Because I have full control of them from inside of plugin.