Pilosa: An open source, distributed index
pilosa.com
pilosa.com
I've been planning to see if I can (mis)use it as an OLAP replacement but I haven't had time to get to it.
https://www.pilosa.com/pdf/PILOSA%20-%20Technical%20White%20...
> Pilosa is a distributed bitmap index that sits on top of a data store. The key to understanding and then using Pilosa is converting data such that it is represented in ones and zeros. This dramatically reduces the size as well as accelerates query times.
> For example, timestamps are important information, but we tend to be interested in individual components of a timestamp, especially when analyzing data with cyclic trends. Timestamp components are stored as groups of bitmaps, known as “frames”. We create one frame for the day of the week, as illustrated in the following table. Along with similar frames for year, month, and time of day, this accelerates queries that ask questions about rides belonging to any logical combination of these time groups.
> [...]
> Because each data point includes pickup/dropoff times and total distance travelled, it’s easy to determine the average speed of the trip. As an example, we use this as a first order approximation of congestion. We created a frame representing average speed, with a spacing of 1 mph.
> In order to answer questions about congestion, we needed to first determine what speeds constitute slow traffic. One of the basic queries in Pilosa is the TopN function, and we used that to get a list of all the different average speeds. By performing a count on each we built a histogram of how many rides fall into each speed bucket, and decided from there which buckets deviate enough from the norm to constitute congestion.
er, what? Isn't it all?
>This dramatically reduces the size
huh? There is no symbolic encoding less efficient for length than binary.
As a concrete example, we took the NYC taxi ride data set which is something like 300GB of CSV files and when it was indexed in Pilosa, the total size of all the bitmap files was closer to 40GB.
What's not obvious is what we're associating with what in the NYC taxi ride data set.
A bitmap can also represent a set: the bit positions denote enumerated element symbols, and the value indicates whether that element is present.
So we rearrange the NYC taxi ride data into a data structure based on graphs and sets, and make large bitmaps?
I.e., decide on a symbolic meaning for the axes rather than converting data wholesale.
Which is not a criticism of Pilosa - I'm sure it's doing something very clever - I just don't understand what.
But really, you use one bitmap for each binary bit of an integer, and it turns out you can generate arbitrary range queries on your dataset by doing various combinations of boolean operations on those bitmaps.
> Pilosa is built around the concept of representing everything as bitmaps.
What this literally means is that not a single datum is stored that is not in the bitmap.
But then the diagrammed examples look like this:
manatee loris sea_horse
Vertebrate 1 1 1
Invertebrate 0 0 0
Breathes Air 1 1 0
Pardon my ignorance, but I see here a bitmap of 9 bits plus six character strings that are obviously not inside that bitmap.If those strings are removed, the bitmap means jack squat.
Are they understood to be in another bitmap?
Sometimes this is a function which might map (for example) row 3 to the letter 'd', 4 to 'e', and so on. Sometimes it has to be a lookup table which can be kept within Pilosa, or externally. Sometimes the IDs map directly to what they represent (day-of-month, year, passenger count, etc.)
So strictly speaking, not everything is a bitmap, but the bulk of the heavy lifting in terms of serving queries is computation on bitmaps.
E.g., turning something like a JSON string of the same data into bits and sticking it in Pilosa.
> The central component of Pilosa’s data model is a boolean matrix. Each cell in the matrix is a single bit; if the bit is set, it indicates that a relationship exists between that particular row and column.
But why do I want my integers sliced apart into these associations?
The Introduction section is a better starting point. There are other sections (Getting Started, Architecture and API Reference) for programmers who want to know the details.