Class ArrayOfDoublesUnion
- java.lang.Object
-
- org.apache.datasketches.tuple.arrayofdoubles.ArrayOfDoublesUnion
-
public abstract class ArrayOfDoublesUnion extends Object
The base class for unions of tuple sketches of type ArrayOfDoubles.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intgetMaxBytes(int nomEntries, int numValues)ArrayOfDoublesCompactSketchgetResult()Returns the resulting union in the form of a compact sketchArrayOfDoublesCompactSketchgetResult(org.apache.datasketches.memory.WritableMemory dstMem)Returns the resulting union in the form of a compact sketchstatic ArrayOfDoublesUnionheapify(org.apache.datasketches.memory.Memory srcMem)Heapify the given Memory as an ArrayOfDoublesUnionstatic ArrayOfDoublesUnionheapify(org.apache.datasketches.memory.Memory srcMem, long seed)Heapify the given Memory and seed as an ArrayOfDoublesUnionvoidreset()Resets the union to an empty statebyte[]toByteArray()voidunion(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(org.apache.datasketches.memory.Memory srcMem)Wrap the given Memory as an ArrayOfDoublesUnionstatic ArrayOfDoublesUnionwrap(org.apache.datasketches.memory.Memory srcMem, long seed)Wrap the given Memory and seed as an ArrayOfDoublesUnionstatic ArrayOfDoublesUnionwrap(org.apache.datasketches.memory.WritableMemory srcMem)Wrap the given WritableMemory as an ArrayOfDoublesUnionstatic ArrayOfDoublesUnionwrap(org.apache.datasketches.memory.WritableMemory srcMem, long seed)Wrap the given WritableMemory and seed as an ArrayOfDoublesUnion
-
-
-
Method Detail
-
heapify
public static ArrayOfDoublesUnion heapify(org.apache.datasketches.memory.Memory srcMem)
Heapify the given Memory as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memory- Returns:
- an ArrayOfDoublesUnion
-
heapify
public static ArrayOfDoublesUnion heapify(org.apache.datasketches.memory.Memory srcMem, long seed)
Heapify the given Memory and seed as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memoryseed- the given seed- Returns:
- an ArrayOfDoublesUnion
-
wrap
public static ArrayOfDoublesUnion wrap(org.apache.datasketches.memory.Memory srcMem)
Wrap the given Memory as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memory- Returns:
- an ArrayOfDoublesUnion
-
wrap
public static ArrayOfDoublesUnion wrap(org.apache.datasketches.memory.Memory srcMem, long seed)
Wrap the given Memory and seed as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memoryseed- the given seed- Returns:
- an ArrayOfDoublesUnion
-
wrap
public static ArrayOfDoublesUnion wrap(org.apache.datasketches.memory.WritableMemory srcMem)
Wrap the given WritableMemory as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memory- Returns:
- an ArrayOfDoublesUnion
-
wrap
public static ArrayOfDoublesUnion wrap(org.apache.datasketches.memory.WritableMemory srcMem, long seed)
Wrap the given WritableMemory and seed as an ArrayOfDoublesUnion- Parameters:
srcMem- the given source Memoryseed- the given seed- Returns:
- an ArrayOfDoublesUnion
-
union
public void union(ArrayOfDoublesSketch tupleSketch)
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 Union must have the same numValues.Nulls and empty sketches are ignored.
- Parameters:
tupleSketch- sketch to add to the union
-
getResult
public ArrayOfDoublesCompactSketch getResult(org.apache.datasketches.memory.WritableMemory dstMem)
Returns the resulting union in the form of a compact sketch- Parameters:
dstMem- memory for the result (can be null)- Returns:
- compact sketch representing the union (off-heap if memory is provided)
-
getResult
public ArrayOfDoublesCompactSketch 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
-
getMaxBytes
public static int getMaxBytes(int nomEntries, int 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
-
-