Class TupleIntersection<S extends Summary>
java.lang.Object
org.apache.datasketches.tuple.TupleIntersection<S>
- Type Parameters:
S- Type of Summary
Computes an intersection of two or more generic TupleSketches or generic TupleSketches
combined with ThetaSketches.
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
ConstructorsConstructorDescriptionTupleIntersection(SummarySetOperations<S> summarySetOps) Creates new TupleIntersection instance with instructions on how to process two summaries that intersect. -
Method Summary
Modifier and TypeMethodDescriptionGets the internal set as an unordered CompactTupleSketchbooleanReturns true if there is a valid intersection result availablevoidintersect(ThetaSketch thetaSketch, S summary) Performs a stateful intersection of the internal set with the given ThetaSketch by combining entries using the hashes from the ThetaSketch and summary values from the given summary and rules from the summarySetOps defined by the TupleIntersection constructor.voidintersect(TupleSketch<S> tupleSketch) Performs a stateful intersection of the internal set with the given TupleSketch.intersect(TupleSketch<S> tupleSketch, ThetaSketch thetaSketch, S summary) Perform a stateless intersect set operation on a TupleSketch and a ThetaSketch and returns the result as an unordered CompactTupleSketch on the heap.intersect(TupleSketch<S> tupleSketchA, TupleSketch<S> tupleSketchB) Perform a stateless intersect set operation on the two given TupleSketches and returns the result as an unordered CompactTupleSketch on the heap.voidreset()Resets the internal set to the initial state, which represents the Universal Set
-
Constructor Details
-
TupleIntersection
Creates new TupleIntersection 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 TupleSketches and returns the result as an unordered CompactTupleSketch 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 CompactTupleSketch on the heap
-
intersect
public CompactTupleSketch<S> intersect(TupleSketch<S> tupleSketch, ThetaSketch thetaSketch, S summary) Perform a stateless intersect set operation on a TupleSketch and a ThetaSketch and returns the result as an unordered CompactTupleSketch 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 ThetaSketch, which doesn't have one. This must not be null.- Returns:
- an unordered CompactTupleSketch 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 ThetaSketch and summary values from the given summary and rules from the summarySetOps defined by the TupleIntersection constructor.- Parameters:
thetaSketch- input ThetaSketch 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 CompactTupleSketch- 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
-