Class UpdatableQuantilesDoublesSketch

java.lang.Object
org.apache.datasketches.quantiles.QuantilesDoublesSketch
org.apache.datasketches.quantiles.UpdatableQuantilesDoublesSketch
All Implemented Interfaces:
MemorySegmentStatus, QuantilesAPI, QuantilesDoublesAPI

public abstract class UpdatableQuantilesDoublesSketch extends QuantilesDoublesSketch
Extends QuantilesDoubleSketch
Author:
Jon Malkin
  • Method Details

    • wrap

      public static UpdatableQuantilesDoublesSketch wrap(MemorySegment srcSeg)
      Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch.

      The given MemorySegment must be writable and it must contain a UpdatableQuantilesDoublesSketch. The sketch will be updated and managed totally within the MemorySegment. If the given source MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.

      NOTE:If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch will request more capacity using the MemorySegmentRequest interface. The default of this interface will return a new MemorySegment on the heap.

      Parameters:
      srcSeg - a MemorySegment that contains sketch data.
      Returns:
      an instance of this sketch that wraps the given MemorySegment.
    • wrap

      Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch and including an optional, user defined MemorySegmentRequest.

      The given MemorySegment must be writable and it must contain a UpdatableQuantilesDoublesSketch. The sketch will be updated and managed totally within the MemorySegment. If the given source MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.

      NOTE:If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch will request more capacity using the MemorySegmentRequest interface. The default of this interface will return a new MemorySegment on the heap. It is up to the user to optionally extend this interface if more flexible handling of requests for more capacity is required.

      Parameters:
      srcSeg - a MemorySegment that contains sketch data.
      mSegReq - the MemorySegmentRequest used if the given MemorySegment needs to expand. Otherwise, it can be null and the default MemorySegmentRequest will be used.
      Returns:
      an instance of this sketch that wraps the given MemorySegment.
    • heapify

      public static UpdatableQuantilesDoublesSketch heapify(MemorySegment srcSeg)
      Factory heapify takes a compact sketch image in MemorySegment and instantiates an on-heap sketch. The resulting sketch will not retain any link to the source MemorySegment.
      Parameters:
      srcSeg - compact MemorySegment image of a sketch serialized by this sketch.
      Returns:
      a heap-based sketch based on the given MemorySegment.
    • compact

      Returns a CompactQuantilesDoublesSketch of this class
      Returns:
      a CompactQuantilesDoublesSketch of this class
    • compact

      Returns a compact version of this sketch. If passing in a MemorySegment object, the compact sketch will use and load that MemorySegment; otherwise, an on-heap sketch will be returned.
      Parameters:
      dstSeg - An optional target MemorySegment to hold the sketch.
      Returns:
      A compact version of this sketch
    • update

      public abstract void update(double item)
      Description copied from interface: QuantilesDoublesAPI
      Updates this sketch with the given item.
      Parameters:
      item - from a stream of items. NaNs are ignored.