BSI Range-Encoding: does it support biggest-N or smallest-N query?
Question: Does BSI Range-Encoding field support biggest-N or smallest-N query? I need to use userID as column number, store a counter for each user, and query biggest-N/smallest-N users and their counter.
Yes, Min and Max calls return minimum and maximum integers respectively for the given BSI field: https://www.pilosa.com/docs/master/query-language/#min
Max returns maximum value and count of columns containing the maximum value.
This is not what I need.
- It doesn't return which columns containing the maximum value.
- It doesn't return other topN columns if N is larger than the returned count.
@yuzhichang If I'm understanding you, it sounds like you want something that returns the topN (or bottomN) values of an int field, along with the columns associated to each of those values.
So with a sample data set like this:
col | 1 2 3 4 5 6 7 8 9
-----------------------
val | 4 5 6 6 5 4 1 2 6
Then performing something like Top(3) would return:
6: [3, 4, 9]
4: [1, 6]
5: [2, 5]
Is that what you mean?
@travisturner Yes, with few difference of the example. I want Top(3) return:
6: [3, 4, 9]
And Top(4) return:
6: [3, 4, 9]
5: [2, 5]
I see. So you want Top(n) on an int field to return the top n columns sorted by value descending.
So effectively, your Top(4) example would return (col, value) pairs like:
3, 6
4, 6
9, 6
2, 5
This is a little different from the existing TopN() because that implementation returns the top rows, which would be like returning the top values of an int field. So if we were to mimic that functionality then TopN(3) on the example int field would be:
6, 3
4, 2
5, 2
We don't currently have anything that returns the top columns, but I understand how that could be useful. Let me think about what it would take to implement this and I'll update this issue.