how to query nested json column and perform aggregation operations in apache druid

Viewed 79

I have data thats in below format and I want to load col 'c' in json format, access elements inside 'c' and perform operations on them like count or group by. How can I do it?

Sample json

  {
    "a": "a_data",
    "b": "b_data",
    "c": {"d": 123,"e": "234","f": "2" }
    }

sample spec

"flattenSpec": {
      "fields": [
        {
          "type": "jq",
          "name": "c_jq",
          "expr": ".c | tojson"
        }
      ]
    }

sample query and result

select c_jq from table

result:
{"d": 123,"e": "234","f": "2" }

I want to select values from col(c->d) and perform aggregation operation on them

select c_jq->d from table 
select sum(c_jq->d) from table
0 Answers
Related