How to sum the distinct order's metrics from a querry?

This is the data I having insert to druid

{“order_id”:“7wqqe5pfdqjdw”, “price”: 284, “time”: “2018-03-24T06:04:00.000Z”}

{“order_id”:“7wqqe5pfdqjdw”, “price”: 284, “time”: “2018-03-24T06:04:00.000Z”}

{“order_id”:“083f68404d7b5d0e”, “price”: 184, “time”: “2018-03-24T06:04:00.000Z”}

{“order_id”:“9a2f5a8d4d730886”, “price”: 484, “time”: “2018-03-24T06:04:00.000Z”}

{“order_id”:“7wqqe5pfdqjdw”, “price”: 284, “time”: “2018-03-24T06:04:00.000Z”}

{“order_id”:“7wqqe5pfdqjdw”, “price”: 284, “time”: “2018-03-24T06:04:00.000Z”}

``

Data is repeatedly written for some reason.

So how can I sum the distinct order’s price from a druid querry?

equivalent to

select sum(price) from (select DISTINCT(order_id), price from table_a)

``

You could try feeding that query into Druid SQL: http://druid.io/docs/latest/querying/sql.html, preprending "EXPLAIN PLAN FOR " to the query would give you the native Druid query that would be executed if you want to see that as well.

How are you ingesting data into Druid? It’s probably a good idea to figure out why you’re getting the duplicate rows as well.