Class ArrayOfDoublesUnion
java.lang.Object
org.apache.datasketches.tuple.arrayofdoubles.ArrayOfDoublesUnion
The base class for unions of tuple sketches of type ArrayOfDoubles.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetMaxBytes(int nomEntries, int numValues) Returns maximum required storage bytes given nomEntries and numValuesReturns the resulting union in the form of a compact sketchgetResult(MemorySegment dstSeg) Returns the resulting union in the form of a compact sketchstatic ArrayOfDoublesUnionheapify(MemorySegment srcSeg) Heapify the given MemorySegment as an ArrayOfDoublesUnion.static ArrayOfDoublesUnionheapify(MemorySegment srcSeg, long seed) Heapify the given MemorySegment and seed as an ArrayOfDoublesUnion.voidreset()Resets the union to an empty statebyte[]Returns a byte array representation of this objectvoidunion(ArrayOfDoublesSketch tupleSketch) Updates the union by adding a set of entries from a given sketch, which can be on-heap or off-heap.static ArrayOfDoublesUnionwrap(MemorySegment srcSeg) Wrap the given MemorySegment as an ArrayOfDoublesUnion.static ArrayOfDoublesUnionwrap(MemorySegment srcSeg, long seed) Wrap the given MemorySegment and seed as an ArrayOfDoublesUnion.
-
Method Details
-
heapify
Heapify the given MemorySegment as an ArrayOfDoublesUnion.- Parameters:
srcSeg- the given source MemorySegment- Returns:
- an ArrayOfDoublesUnion
-
heapify
Heapify the given MemorySegment and seed as an ArrayOfDoublesUnion.- Parameters:
srcSeg- the given source MemorySegmentseed- the given seed- Returns:
- an ArrayOfDoublesUnion
-
wrap
Wrap the given MemorySegment as an ArrayOfDoublesUnion. If the given source MemorySegment is read-only, the returned TupleUnion object will also be read-only.- Parameters:
srcSeg- the given source MemorySegment- Returns:
- an ArrayOfDoublesUnion
-
wrap
Wrap the given MemorySegment and seed as an ArrayOfDoublesUnion. If the given source MemorySegment is read-only, the returned TupleUnion object will also be read-only.- Parameters:
srcSeg- the given source MemorySegmentseed- the given seed- Returns:
- an ArrayOfDoublesUnion
-
union
Updates the union by adding a set of entries from a given sketch, which can be on-heap or off-heap. Both the given tupleSketch and the internal state of the TupleUnion must have the same numValues.Nulls and empty sketches are ignored.
- Parameters:
tupleSketch- sketch to add to the union.
-
getResult
Returns the resulting union in the form of a compact sketch- Parameters:
dstSeg- MemorySegment for the result (can be null)- Returns:
- compact sketch representing the union (off-heap if MemorySegment is provided)
-
getResult
Returns the resulting union in the form of a compact sketch- Returns:
- on-heap compact sketch representing the union
-
reset
public void reset()Resets the union to an empty state -
toByteArray
public byte[] toByteArray()Returns a byte array representation of this object- Returns:
- a byte array representation of this object
-
getMaxBytes
public static int getMaxBytes(int nomEntries, int numValues) Returns maximum required storage bytes given nomEntries and numValues- Parameters:
nomEntries- Nominal number of entries. Forced to the nearest power of 2 greater than or equal to given value.numValues- Number of double values to keep for each key- Returns:
- maximum required storage bytes given nomEntries and numValues
-