[ZODB-Dev] n-way join algoritms

Tim Peters tim at zope.com
Mon Jun 23 16:07:13 EDT 2003


[Shane]
>> FYI: there is also a multiunion() utility in recent versions of the
>> BTrees code.  It accepts a sequence of sets and returns a set.  Use
>> it where you can, because it was created and optimized by Tim "I can
>> make it faster yet" Peters. :-)

[Steve Alexander]
> Please can this be documented in the interfaces.py file of BTrees.

Maybe.  I usually think of that file as dead weight, so need some help
understanding what would be useful there.  As is, it seems to pretend to a
lot of generality that doesn't exist, and defines any number of interfaces
that aren't actually referenced anywhere (e.g., IReadSequence is never
referenced in code, IIMerge is never referenced anywhere (not even in
comments), and IMerge is referenced only as a base class for the
unreferenced IIMerge).

The multiunion business doesn't fit into any of the current interfaces
(whether or not currently used):  it's supplied only by the btree flavors
with integer keys, and that distinction isn't currently made anywhere.

Now if I could just say "multiunion is supplied by IIBTree and IOBTree, and
that's it", cool.  I don't seem to have the right kind of brain to pretend
the world is 100x more general than that.  For example, would it be helpful
to make up an interface meaning "like IMerge, but restricted to integer
keys", and then make up an interface derived from that with a single
multiunion method?  If so, I suppose it could be done.  OTOH, when I was
first learning the btree package, I found its interfaces.py file to be more
confusing than illuminating.




More information about the ZODB-Dev mailing list