kumulant

HeavyHittersResult

@Serializable
@SerialName(value = "HeavyHittersResult")
data class HeavyHittersResult(val capacity: Int, val keys: LongArray, val counts: LongArray, val errors: LongArray, val totalSeen: Long, val policy: AdmissionPolicy = AdmissionPolicy.Classic, val deficit: Long = 0) : HasObservationCount(source)

Space-Saving heavy-hitters snapshot. keys, counts, errors are parallel arrays of length <= capacity. totalSeen is the unweighted update count.

The true weighted count of a tracked key lies in [counts[i] - errors[i], counts[i] + deficit]. Each bound closes one direction, and which one is slack depends on policy:

  • Under AdmissionPolicy.Classic a count can only overestimate. errors carries the per-key bound inherited from the evicted minimum, and deficit is zero.

  • Under AdmissionPolicy.MisraGries a count can only underestimate, because it is only ever incremented exactly or decremented in bulk. errors is zero - correctly, not for want of a bound - and deficit carries the number of decrement rounds, which bounds the shortfall for every key.

A merge that mixes the two accumulates deficit and degrades policy, so both bounds stay sound.

Constructors

HeavyHittersResult

constructor(capacity: Int, keys: LongArray, counts: LongArray, errors: LongArray, totalSeen: Long, policy: AdmissionPolicy = AdmissionPolicy.Classic, deficit: Long = 0)(source)

Properties

capacity

counts

deficit

Bulk-decrement rounds absorbed; bounds how far any count may fall below the true count.

errors

keys

policy

Which algorithm produced these counts, and so which direction their slack runs in.

totalSeen

totalWeights

open override val totalWeights: Double(source)

Cumulative weight of observations folded into this result.

Link copied to clipboard
open val isEmpty: Boolean

True when no observation has been folded in, so every other field is a placeholder.

Functions

equals

open operator override fun equals(other: Any?): Boolean(source)

hashCode

open override fun hashCode(): Int(source)

toString

open override fun toString(): String(source)