Query on map supports in druid

I am having clickstreams of data in AVRO format. One of my Avro fields is of type map. After ingestion, It is replaced as a string type dimension column in druid. So, I am not able to query on a member of the map.

Does the druid support map as a column type? Currently, I am getting an error for the below query as "Column tags[“color] not found in any table / org.apache.calcite.tools.ValidationException”

SELECT * from product-click-events WHERE tags[“color”] = “red”

Here tags is a map column and color is one of the key in the map. Is there a way that I can query on map data?

For reference :

I am using a version of druid: druid-0.16.0

For reference below is my Enter code here…
Avro spec.

{

“type”:“kafka”,

“dataSchema”:{

  "dataSource":"product-click-events",

 "parser":{

     "type":"avro_stream",

    "avroBytesDecoder":{

        "type":"schema_inline",

       "schema":{

           "type":"record",

          "name":"product-click-events",

          "namespace":"product.click.events",

          "fields":[

              {

                 "name":"product_id",

                "type":"bytes"

             },

             {

                 "name":"user_id",

                "type":"bytes"

             },

             {

                 "name":"name",

                "type":{

                    "type":"string",

                   "avro.java.string":"String"

                }

             },

             {

                 "name":"category",

                "type":{

                    "type":"string",

                   "avro.java.string":"String"

                }

             },

             {

                 "name":"description",

                "type":{

                    "type":"string",

                   "avro.java.string":"String"

                }

             },

             {

                 "name":"tags",

                "type":{

                    "type":"map",

                   "values":{

                       "type":"string",

                      "avro.java.string":"String"

                   },

                   "avro.java.string":"String"

                },

                "default":{

                 }

             },

             {

                 "name":"click_time_millis",

                "type":"long",

                "default":0

             },

          ]

       }

    },

    "parseSpec":{

        "format":"avro",

       "timestampSpec":{

           "column":"click_time_millis",

          "format":"auto"

       },

       "dimensionsSpec":{

           "dimensions":[

             "product_id",

             "user_id",

              "name",

             "category",

             {

                 "name":"tags",

                "type":"map"

             },

             "description"

          ]

       }

    }

 },

 "metricsSpec":[

  ],

 "granularitySpec":{

     "type":"uniform",

    "segmentGranularity":"HOUR",

    "queryGranularity":{

        "type":"none"

    },

    "rollup":true,

    "intervals":null

 },

},

“tuningConfig”:{

  "type": "kafka",

 "reportParseExceptions": true

},

“ioConfig”:{

  "type":"kafka",

 "topic":"product-click-events",

 "consumerProperties":{

     "bootstrap.servers":"localhost:9092"

 },

 "pollTimeout":100,

 "replicas": 2,

 "taskDuration": "PT10M",

 "completionTimeout": "PT20M",

},

“context”:null,

“suspended”:false

}

``

You would need to use flatten spec to flatten the map out into queryable columns.

https://druid.apache.org/docs/latest/development/extensions-core/avro.html

https://druid.apache.org/docs/latest/ingestion/index.html#flattenspec

Cheers,

Rachel

I have a map structure something like shown below. All keys are not statically defined, and there are some keys which are dynamics.

tags: {

“color” : “red”,

“size” : “large”

}

So, I thought of splitting all the keys to one multi-value string columns and values to another column.

As flattenSpec for AVRO format only supports jsonPath, I was not able to extract keys to the column. However, I was able to extract all values to column using jsonPath - $.tags.*

Is there any other way, I can do the same? or What do you suggest how can I flatten such a map in a queriable format or do you suggest to change my map structure to have only static keys?