7eggs / node-druid-query

Simple querying library for Druid (http://druid.io)
MIT License
94 stars 39 forks source link

DoubleMax Aggregation not supported #32

Open Shabhana opened 5 years ago

Shabhana commented 5 years ago

We have druid-query like below:

var q5 = client.groupBy()
q5.dataSource('stmp_dlv_1')
q5.granularity('month')
q5.dimensions(['txn_mth'])
q5.aggregation('doubleSum', 'GROSS', 'sum_gross')
q5.aggregation('doubleMax', 'NTPV', 'max_global_ntpv')

q5.exec(function(err, result) {
  if (err) {
    // handle error...
    console.log("*****error*****",err)
  }
  else {
    console.log("******result****",result);
  }
})

Getting below error :

/Users/srajathii/Documents/hikma/Site/node_modules/druid-query/lib/fields/aggregations.js:51
    throw new FieldError('Unknown aggregation type: ' + type)
    ^

Error: Unknown aggregation type: doubleMax
    at aggregation (/Users/srajathii/Documents/hikma/Site/node_modules/druid-query/lib/fields/aggregations.js:51:11)
    at exports.aggregation (/Users/srajathii/Documents/hikma/Site/node_modules/druid-query/lib/fields/aggregations.js:18:22)
    at GroupByQuery.proto.(anonymous function) [as aggregation] (/Users/srajathii/Documents/hikma/Site/node_modules/druid-query/lib/query.js:124:27)
    at Object.<anonymous> (/Users/srajathii/Documents/hikma/Site/bin/www:206:4)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)

Also tried q5.aggregation('max', 'NTPV', 'max_global_ntpv')

getting same error.

Can you please help with a way to find the max value of the metric?

netik commented 4 years ago

Same goes for floatMax, no support there either.

I think this library is largely incomplete and doesn't support features in the latest druid (0.20)

netik commented 4 years ago

fwiw, I ended up abandoning this library and moving over to Imply Ply and using druidRequestor outside of Ply for JSON queries, which returns promises. It seems to be far more supported.