postAggregations JSON error

Hello,
I’m trying to test my first postAggregations with this data :

{“timestamp”: “2013-08-31T01:02:33Z”,“code”:“A”, “qty”:“2000”,“price”:“10”}

{“timestamp”: “2013-08-31T01:02:33Z”,“code”:“B”, “qty”:“10000”,“price”:“7”}

and this call :

{

“queryType”: “topN”,

“dataSource”: “asset”,

“granularity”: “all”,

“dimension”: “code”,

“metric”: “qty”,

“threshold”: 10,

“aggregations”: [

{

“type”: “longSum”,

“fieldName”: “qty”,

“name”: “qty”

},

{

“type”: “longSum”,

“fieldName”: “price”,

“name”: “price”

}

],

“postAggregations”: {

“type”: “arithmetic”,

“name”: “value”,

“fn”: “*”,

“fields”: [

{

“type”: “fieldAccess”,

“name”: “qty”,

“fieldName”: “qty”

},

{

“type”: “fieldAccess”,

“name”: “price”,

“fieldName”: “price”

}

]

},

“intervals”: [

“2012-10-01T00:00/2020-01-01T00”

]

}

But I have this error :

2015-07-22T13:20:03,105 ERROR [qtp135002781-29] io.druid.server.QueryResource - Exception handling request: {class=io.druid.server.QueryResource, exceptionType=class com.fasterxml.jackson.databind.JsonMappingException, exceptionMessage=Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

at [Source: HttpInputOverHTTP@216b288a; line: 1, column: 380], exception=com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

=> it’s my first day using Druid so I don’t know if I’m doing something wrong or it’s a bug with JSON parsing.

Regards,

Nihed MBAREK

Hi,

post aggregations are “List” or things, so you would have to have

“postAggregations”: […]

and not
“postAggregations”: {…}

– Himanshu

it works, thank you