stupidb.associative.segmenttree¶
Functions
|
Make a segment tree from tuples leaves and class aggregate_type. |
Classes
|
A segment tree for window aggregation. |
- class stupidb.associative.segmenttree.SegmentTree(leaves, aggregate_type, *, fanout)[source]¶
A segment tree for window aggregation.
- nodes¶
The nodes of the segment tree
- aggregate_type¶
The class of the aggregate to use
- levels¶
A list of the nodes in each level of the tree
- fanout¶
The number of leaves to aggregate into each interior node
- stupidb.associative.segmenttree.make_segment_tree(leaf_arguments, aggregate_type, *, fanout)[source]¶
Make a segment tree from tuples leaves and class aggregate_type.
The algorithm used here traverses from the bottom of tree upward, updating the parent every time a new node is seen.
- Parameters
leaves – A sequence of tuples that make up the leaves of the segment tree
aggregate_type – The aggregate class whose instances compose the tree.