Incompatible type for metric[<dim_name>], expected a HyperUnique, got a class java.lang.String


I get the error mentioned in the subject line when querying data ingested into Druid 0.8.3 via a Realtime node that reads from Kafka using this spec. I defined a hyperUnique metric like so:

“metricsSpec”: [


 "type": "hyperUnique",
 "name": "unique_bid",
 "fieldName": "bid"



where “bid” is part of the dimensionsSpec. When I run datasource meta data query against the broker the result is weird:

“unique_bid” : {

“type” : “STRING”,

“size” : -1,

“cardinality” : null,

“errorMessage” : “error:cannot_merge_diff_types”


and when I include the this metric in an aggregation query it returns an error:


“error” : “Incompatible type for metric[bid], expected a HyperUnique, got a class java.lang.String”


What is the cause of this?

Also, assuming I messed up and need to re-create the same datasource from scratch. What is the best approach? Disable datasource, delete old segments - anything else to do to make Druid forget about a datasource?

Thank you in advance,


Try indexing the data again, but remove “bid” from your list of dimensions.

Thank you for your reply. I flattened the datasource and tried again - this time it worked, even with “bid” listed as a dimension… weird.