I have a table with two fields : "user","some_integer"
And I was wondering if there is a way of doing something like:
select count(distinct("user")), "bit" from random_table group by bit(some_number);
Impala has bitwise AND/OR/XOR. For example, you can:
select count(distinct("user")), some_number & mask as bit from random_table group by bit;
You construct 'mask' to zero out all bits except the one you want.
Thanks for you answer!
I actualy want to group by all the possible mask of a single 1 bit.
thanks to you I think I have a solution:
I will first construct a table with all my masks (1,2,4,8,...) and then do a join with my table with an "and" operator. That should "epxlode" my rows to have all possible groups filtering all "bit"=0 to only have the valid groups.
Not exactly sure about how my query will look like yet... But i think it should be possible that way