Group by on a multi value dimension with aggregations

Hi all,

I’ve got the following use case. I want to group by a multi-value dimension and then aggregate on different column depending on the value of the “multi-value-dimension”…

i.e I would like to aggregate sum on d3 if value = d1 or d4 if value =d2

multi-value-dimension
d1
d2
d3
d4
[a,b]
a
b
1
2
[c,a]
c
a
1
2

When I group-by it druid gives me the following

multi-value-dimension
a
a
b
1
2
b
a
b
1
2
c
c
a
1
2
a
c
a
1
2

But I need the following…

Aggregation
multi-value-dimension
sum aggregation on d3 or d4

a
3(1+2)
b
2
c
1

One way to achieve this would be a nested group by on the multi value dimension but would like to avoid that if possible.

Does anyone know whether there is any way to achieve this, or to evaluate the “multi-value-dimension” at query time?

Thanks all

Alex

Hi Alex,

Very interesting use case. I think the only way is to do nested group by.

Lets see if anybody else has a better solve. Eager to see other alternate solutions.

Regards, Chari.