Package org.apache.datasketches.tuple
Class Intersection<S extends Summary>
java.lang.Object
org.apache.datasketches.tuple.Intersection<S>
- Type Parameters:
S
- Type of Summary
Computes an intersection of two or more generic tuple sketches or generic tuple sketches
combined with theta sketches.
A new instance represents the Universal Set. Because the Universal Set
cannot be realized a getResult() on a new instance will produce an error.
Every update() computes an intersection with the internal state, which will never
grow larger and may be reduced to zero.
-
Constructor Summary
ConstructorDescriptionIntersection
(SummarySetOperations<S> summarySetOps) Creates new Intersection instance with instructions on how to process two summaries that intersect. -
Method Summary
Modifier and TypeMethodDescriptionGets the internal set as an unordered CompactSketchboolean
Returns true if there is a valid intersection result availablevoid
Performs a stateful intersection of the internal set with the given thetaSketch by combining entries using the hashes from the theta sketch and summary values from the given summary and rules from the summarySetOps defined by the Intersection constructor.void
Performs a stateful intersection of the internal set with the given tupleSketch.Perform a stateless intersect set operation on a tuple sketch and a theta sketch and returns the result as an unordered CompactSketch on the heap.Perform a stateless intersect set operation on the two given tuple sketches and returns the result as an unordered CompactSketch on the heap.void
reset()
Resets the internal set to the initial state, which represents the Universal Set
-
Constructor Details
-
Intersection
Creates new Intersection instance with instructions on how to process two summaries that intersect.- Parameters:
summarySetOps
- instance of SummarySetOperations
-
-
Method Details
-
intersect
Perform a stateless intersect set operation on the two given tuple sketches and returns the result as an unordered CompactSketch on the heap.- Parameters:
tupleSketchA
- The first sketch argument. It must not be null.tupleSketchB
- The second sketch argument. It must not be null.- Returns:
- an unordered CompactSketch on the heap
-
intersect
Perform a stateless intersect set operation on a tuple sketch and a theta sketch and returns the result as an unordered CompactSketch on the heap.- Parameters:
tupleSketch
- The first sketch argument. It must not be null.thetaSketch
- The second sketch argument. It must not be null.summary
- the given proxy summary for the theta sketch, which doesn't have one. This must not be null.- Returns:
- an unordered CompactSketch on the heap
-
intersect
Performs a stateful intersection of the internal set with the given tupleSketch.- Parameters:
tupleSketch
- input sketch to intersect with the internal state. It must not be null.
-
intersect
Performs a stateful intersection of the internal set with the given thetaSketch by combining entries using the hashes from the theta sketch and summary values from the given summary and rules from the summarySetOps defined by the Intersection constructor.- Parameters:
thetaSketch
- input theta sketch to intersect with the internal state. It must not be null.summary
- the given proxy summary for the theta sketch, which doesn't have one. It will be copied for each matching index. It must not be null.
-
getResult
Gets the internal set as an unordered CompactSketch- Returns:
- result of the intersections so far
-
hasResult
public boolean hasResult()Returns true if there is a valid intersection result available- Returns:
- true if there is a valid intersection result available
-
reset
public void reset()Resets the internal set to the initial state, which represents the Universal Set
-