PathSketch

What has been observed at one path.

Immutable and mergeable. Mergeable is the load-bearing half: the model of a whole store is the fold of its live segments' sketches, so if merge were not associative and commutative the model would depend on the order compaction happened to run in rather than on the data. Every field here merges by summation or by a bound, both of which have that property; the cardinality estimator has it too, by construction — see HyperLogLog.

observations counts documents, not values. A path is observed once per document that has it, so observations / documentCount is the presence ratio, and a path under an CatalogStep.AnyElement step is observed once per element, which is why its ratio can exceed one. That is the honest number for an array: $.tags[*] really does occur three times in a document with three tags.

totalBytes is the encoded size of the value at this path, subtree included. So an object's bytes are also counted in each of its fields. That is deliberate: the question "what fraction of a document is this subtree" is the one that decides whether shredding a path is worth it, and it needs the subtree total.

Properties

Link copied to clipboard

Mean encoded size of a value at this path.

Link copied to clipboard

Numeric and text ranges. See ValueBounds.

Link copied to clipboard

Estimated distinct scalar values at this path.

Link copied to clipboard

Whether distinctEstimate is exact rather than estimated. See HyperLogLog.

Link copied to clipboard

The kind that accounts for the most observations, or null when nothing was observed.

Link copied to clipboard

Observations whose value was the JSON null.

Link copied to clipboard

Documents — or array elements — in which this path was present.

Link copied to clipboard

Total encoded size of the values at this path. See the class documentation.

Link copied to clipboard

How many observations each kind accounted for, largest first.

Link copied to clipboard

The share of observations that took dominantType, in 0.0..1.0.

Functions

Link copied to clipboard
fun count(kind: VariantKind): Long

Observations of kind at this path.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

This sketch folded with other. Associative, commutative, and never lossy.

Link copied to clipboard
open override fun toString(): String