mirror of
https://github.com/apache/druid.git
synced 2025-02-13 05:25:11 +00:00
* Speed up composite key joins on IndexedTable. Prior to this patch, IndexedTable indexes are sorted IntList. This works great when we have a single-column join key: we simply retrieve the list and we know what rows match. However, when we have a composite key, we need to merge the sorted lists. This is inefficient when one is very dense and others are very sparse. This patch switches from sorted IntList to IntSortedSet, and changes to the following intersection algorithm: 1) Initialize the intersection set to the smallest matching set from the various parts of the composite key. 2) For each element in that smallest set, check other sets for that element. If any do *not* include it, then remove the element from the intersection set. This way, complexity scales with the size of the smallest set, not the largest one. * RangeIntSet stuff.