Split based on hyperUnique column

Is it possible to split by a hyperUnique column in Druid?

I am trying to define a custom metric in the Pivot UI like below

$main.split($user_id).apply(‘B’, $main.max($weight) * $main.sum($visits)).sum($B)


But the result in Druid is coming out to be way way more than what we get by doing a similar query in our source data in Hive…

Below is our corresponding query in Hive…

WITH tmp_table AS (
SELECT user_id, MAX(weight) weight, SUM(visits) visits
FROM user_visits
GROUP BY user_id
SELECT SUM(weight * visit) AS us_visits FROM tmp_table;


Hey Pratik,

It is not possible, because hyperUniques are metrics, and can only be aggregated (not filtered or grouped). If you need to be able to group by it (which is basically what a split is) then you must ingest it as a dimension.

Thanks for the clarification Gian. This really helps.