Tuple Policy
A Tuple Policy is needed when using a tuple_sketch
in order to specify how the
summary values should be created, updated, combined, or intersected. A summary can consist of
any python object.
Each implementation must extend the abstract base class TuplePolicy
.
- class TuplePolicy(*args, **kwargs)
An abstract base class for Tuple Policy objects. All custom policies must extend this class.
- create_summary(self) object
Creates a new Summary object
- Returns:
a Summary object
- Return type:
object
- update_summary(self, summary: object, update: object) object
Applies the relevant policy to update the provided summary with the data in update.
- Parameters:
summary (
object
) – An existing Summaryupdate (
object
) – An update to apply to the Summary
- Returns:
The updated Summary
- Return type:
object
- __call__(self, summary: object, update: object) object
Similar to update_summary but allows a different implementation for set operations (union and intersection)
- Parameters:
summary (
object
) – An existing Summaryupdate (
object
) – An update to apply to the Summary
- Returns:
The updated Summary
- Return type:
object
- class AccumulatorPolicy
Bases:
TuplePolicy
Implements an accumulatory summary policy, where new values are added to the existing value.
- class MinIntPolicy
Bases:
TuplePolicy
Implements a MIN rule, where the smallest integer value is always kept.
- class MaxIntPolicy
Bases:
TuplePolicy
Implements a MAX rule, where the largest integer value is always kept.