node-druid-query icon indicating copy to clipboard operation
node-druid-query copied to clipboard

DoubleMax Aggregation not supported

Open Shabhana opened this issue 6 years ago • 2 comments

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?

Shabhana avatar Aug 28 '19 08:08 Shabhana

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 avatar Oct 29 '20 20:10 netik

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.

netik avatar Nov 04 '20 20:11 netik