Class TupleUnion<S extends Summary>
java.lang.Object
org.apache.datasketches.tuple.TupleUnion<S>
- Type Parameters:
S- Type of Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTupleUnion(int nomEntries, SummarySetOperations<S> summarySetOps) Creates new TupleUnion instance.TupleUnion(SummarySetOperations<S> summarySetOps) Creates new TupleUnion instance with instructions on how to process two summaries that overlap. -
Method Summary
Modifier and TypeMethodDescriptionGets the result of a sequence of stateful union operations as an unordered CompactTupleSketchgetResult(boolean reset) Gets the result of a sequence of stateful union operations as an unordered CompactTupleSketch.voidreset()Resets the internal set to the initial state, which represents an empty set.voidunion(ThetaSketch thetaSketch, S summary) Performs a stateful union of the internal set with the given ThetaSketch by combining entries using the hashes from the ThetaSketch and summary values from the given summary.voidunion(TupleSketch<S> tupleSketch) Performs a stateful union of the internal set with the given TupleSketch.union(TupleSketch<S> tupleSketch, ThetaSketch thetaSketch, S summary) Perform a stateless, pair-wise union operation between a tupleSketch and a ThetaSketch.union(TupleSketch<S> tupleSketchA, TupleSketch<S> tupleSketchB) Perform a stateless, pair-wise union operation between two tuple sketches.
-
Constructor Details
-
TupleUnion
Creates new TupleUnion instance with instructions on how to process two summaries that overlap. This will have the default nominal entries (K).- Parameters:
summarySetOps- instance of SummarySetOperations
-
TupleUnion
Creates new TupleUnion instance.- Parameters:
nomEntries- nominal entries (K). Forced to the nearest power of 2 greater than given value.summarySetOps- instance of SummarySetOperations
-
-
Method Details
-
union
Perform a stateless, pair-wise union operation between two tuple sketches. The returned sketch will be cut back to the smaller of the two k values if required.Nulls and empty sketches are ignored.
- Parameters:
tupleSketchA- The first argumenttupleSketchB- The second argument- Returns:
- the result ordered CompactTupleSketch on the heap.
-
union
Perform a stateless, pair-wise union operation between a tupleSketch and a ThetaSketch. The returned sketch will be cut back to the smaller of the two k values if required.Nulls and empty sketches are ignored.
- Parameters:
tupleSketch- The first argumentthetaSketch- The second argumentsummary- the given proxy summary for the ThetaSketch, which doesn't have one. This may not be null.- Returns:
- the result ordered CompactTupleSketch on the heap.
-
union
Performs a stateful union of the internal set with the given TupleSketch.- Parameters:
tupleSketch- input tuple sketch to merge with the internal set. Nulls and empty sketches are ignored.
-
union
Performs a stateful union of the internal set with the given ThetaSketch by combining entries using the hashes from the ThetaSketch and summary values from the given summary.- Parameters:
thetaSketch- the given ThetaSketch input. If null or empty, it is ignored.summary- the given proxy summary for the ThetaSketch, which doesn't have one. This may not be null.
-
getResult
Gets the result of a sequence of stateful union operations as an unordered CompactTupleSketch- Returns:
- result of the stateful unions so far. The state of this operation is not reset after the result is returned.
-
getResult
Gets the result of a sequence of stateful union operations as an unordered CompactTupleSketch.- Parameters:
reset- If true, clears this operator to the empty state after this result is returned. Set this to false if you wish to obtain an intermediate result.- Returns:
- result of the stateful union
-
reset
public void reset()Resets the internal set to the initial state, which represents an empty set. This is only useful after sequences of stateful union operations.
-