Uniq equivalent in Druid

Apologies if I posted this in the wrong place.
At times, I may want to summarize the data rather than use groupby. Uniq does this by collapsing repeated lines. This may also alleviate your concerns as such a filter has better performance than groupby. Even Python’s itertools groupby does the same thing as uniq. How do I accomplish this in Druid?

Sorry, I’m not sure what you mean. groupBy, like uniq, will collapse repeated values (by grouping them together).

Nope. Druid’s groupby collapses all rows according to a given key, unlike python itertools’ groupby.
Check the below code on Ipython.

This using itertools groupby.

from itertools import groupby
In [1]: a=[[‘a’,1],[‘a’,2],[‘c’,3],[‘a’,4],[‘a’,5],[‘a’,6]]

In [2]: for i,j in groupby(a, key=lambda x: x[0]):
…: print(i, list(j))
…:
(‘a’, [[‘a’, 1], [‘a’, 2]])
(‘c’, [[‘c’, 3]])
(‘a’, [[‘a’, 4], [‘a’, 5], [‘a’, 6]])

``

Now, using pandas groupby,

In [9]: a
Out[9]: [[‘a’, 1], [‘a’, 2], [‘c’, 3], [‘a’, 4], [‘a’, 5], [‘a’, 6]]

In [10]: for i,j in pd.DataFrame(a, columns=[‘A’,‘B’]).groupby(‘A’):
…: print(i)
…: print(j)
…:
a
A B
0 a 1
1 a 2
3 a 4
4 a 5
5 a 6
c
A B
2 c 3

``

Do you now see the difference? Druid already has Pandas groupby. I need something like the Itertools groupby.