Can not sum up theta sketch result from inner query

Hello,

I have the following query:

{

“context” : {

“timeout” : 60000,

“maxResults” : 100000

},

“queryType” : “groupBy”,

“aggregations” : [ {

“type” : “doubleSum”,

“name” : “usersSum”,

“fieldName” : “userIdSketch”

}],

“intervals” : [ “2016-09-23T11:31:00/2016-10-30T12:30:59” ],

“granularity” : “all”,

“dataSource” : {

“type” : “query”,

“query” : {

“context” : {

“timeout” : 60000,

“maxResults” : 100000

},

“queryType” : “groupBy”,

“aggregations” : [ {

“type” : “thetaSketch”,

“name” : “userIdSketch”,

“fieldName” : “userIdSketch”

}],

“intervals” : [ “2016-09-23T11:31:00/2016-10-30T12:30:59” ],

“granularity” : “all”,

“dataSource” : {

“type” : “table”,

“name” : “TableSource”

},

“dimensions” : [“serviceId”]

}

}

}

``

In the inner query, I am trying to compute theta sketch value of userId for each service. And in the outer query, I want, to sum up those values. Although, If I run the query I get the following exception:

{

“error”: “Encountered parse error for aggregator[userIdSketch]”

}

``

The inner query itself returns the correct result.

What I noticed is that if I specify some other aggregation in inner query - doubleSum for instance, I get correct result without any error.

{

“context” : {

“timeout” : 60000,

“maxResults” : 100000

},

“queryType” : “groupBy”,

“aggregations” : [ {

“type” : “doubleSum”,

“name” : “successSum”,

“fieldName” : “success”

}],

“intervals” : [ “2016-09-23T11:31:00/2016-10-30T12:30:59” ],

“granularity” : “all”,

“dataSource” : {

“type” : “query”,

“query” : {

“context” : {

“timeout” : 60000,

“maxResults” : 100000

},

“queryType” : “groupBy”,

“aggregations” : [ {

“type” : “doubleSum”,

“name” : “success”,

“fieldName” : “success”

}],

“intervals” : [ “2016-09-23T11:31:00/2016-10-30T12:30:59” ],

“granularity” : “all”,

“dataSource” : {

“type” : “table”,

“name” : “TableSource”

},

“dimensions” : [“serviceId”]

}

}

}

``

Is this a bug, by design or just I am doing something wrong?

Thank you for your time.

Kind regards,

Levani.

hi, Levani

I am a user of druid.

As I think, maybe you can try add a post aggregator in your inner query:

{
  "type"  : "thetaSketchEstimate",
  "name": <output name>,
  "field"  : <post aggregator of type fieldAccess that refers to a thetaSketch aggregator or that of type thetaSketchSetOp>
}

and sum this field in outer query.

在 2016年10月30日星期日 UTC+8下午9:18:30,Levani Kokhreidze写道: