Skip to content
Permalink
Browse files
Made getMaxSerializedSizeBytes(...) static in both KllDoublesSketch and
KllFloatsSketch
  • Loading branch information
leerho committed Apr 15, 2022
1 parent 4cf19d1 commit 01d82bc4de62c7e68fd23c5f7cacd5f700a15fb7
Showing 3 changed files with 23 additions and 23 deletions.
@@ -38,6 +38,17 @@ public abstract class KllDoublesSketch extends KllSketch {
super(SketchType.DOUBLES_SKETCH, wmem, memReqSvr);
}

/**
* Returns upper bound on the serialized size of a KllDoublesSketch given the following parameters.
* @param k parameter that controls size of the sketch and accuracy of estimates
* @param n stream length
* @param updatableMemoryFormat true if updatable Memory format, otherwise the standard compact format.
* @return upper bound on the serialized size of a KllSketch.
*/
public static int getMaxSerializedSizeBytes(final int k, final long n, final boolean updatableMemoryFormat) {
return getMaxSerializedSizeBytes(k, n, SketchType.DOUBLES_SKETCH, updatableMemoryFormat);
}

/**
* Factory heapify takes the sketch image in Memory and instantiates an on-heap sketch.
* The resulting sketch will not retain any link to the source Memory.
@@ -170,17 +181,6 @@ public double[] getCDF(final double[] splitPoints) {
return KllDoublesHelper.getDoublesPmfOrCdf(this, splitPoints, true);
}

/**
* Returns upper bound on the serialized size of a KllDoublesSketch given the following parameters.
* @param k parameter that controls size of the sketch and accuracy of estimates
* @param n stream length
* @param updatableMemoryFormat true if updatable Memory format, otherwise the standard compact format.
* @return upper bound on the serialized size of a KllSketch.
*/
public int getMaxSerializedSizeBytes(final int k, final long n, final boolean updatableMemoryFormat) {
return getMaxSerializedSizeBytes(k, n, SketchType.DOUBLES_SKETCH, updatableMemoryFormat);
}

/**
* Returns the max value of the stream.
* If the sketch is empty this returns NaN.
@@ -38,6 +38,17 @@ public abstract class KllFloatsSketch extends KllSketch {
super(SketchType.FLOATS_SKETCH, wmem, memReqSvr);
}

/**
* Returns upper bound on the serialized size of a KllFloatsSketch given the following parameters.
* @param k parameter that controls size of the sketch and accuracy of estimates
* @param n stream length
* @param updatableMemoryFormat true if updatable Memory format, otherwise the standard compact format.
* @return upper bound on the serialized size of a KllSketch.
*/
public static int getMaxSerializedSizeBytes(final int k, final long n, final boolean updatableMemoryFormat) {
return getMaxSerializedSizeBytes(k, n, SketchType.FLOATS_SKETCH, updatableMemoryFormat);
}

/**
* Factory heapify takes the sketch image in Memory and instantiates an on-heap sketch.
* The resulting sketch will not retain any link to the source Memory.
@@ -170,17 +181,6 @@ public double[] getCDF(final float[] splitPoints) {
return KllFloatsHelper.getFloatsPmfOrCdf(this, splitPoints, true);
}

/**
* Returns upper bound on the serialized size of a KllFloatsSketch given the following parameters.
* @param k parameter that controls size of the sketch and accuracy of estimates
* @param n stream length
* @param updatableMemoryFormat true if updatable Memory format, otherwise the standard compact format.
* @return upper bound on the serialized size of a KllSketch.
*/
public int getMaxSerializedSizeBytes(final int k, final long n, final boolean updatableMemoryFormat) {
return getMaxSerializedSizeBytes(k, n, SketchType.FLOATS_SKETCH, updatableMemoryFormat);
}

/**
* Returns the max value of the stream.
* If the sketch is empty this returns NaN.
@@ -192,7 +192,7 @@ public static int getKFromEpsilon(final double epsilon, final boolean pmf) {
* @param k parameter that controls size of the sketch and accuracy of estimates
* @param n stream length
* @return upper bound on the compact serialized size
* @deprecated use getMaxSerializedSizeBytes(int, long, SketchType, boolean) instead.
* @deprecated use getMaxSerializedSizeBytes(int, long, boolean) instead.
* Version 3.2.0
*/
@Deprecated

0 comments on commit 01d82bc

Please sign in to comment.