ValueBoundsBuilder

class ValueBoundsBuilder(textBoundBytes: Int)

Accumulates ValueBounds from the scalars at one path.

Shared rather than reimplemented, for the reason ValueSignature is: a bound is what a query uses to decide a segment cannot contain a match, and the rule that makes that safe — truncation always widens, never narrows — is subtle enough that a second implementation would eventually get it backwards. When it did, the failure would be a document silently missing from a result rather than anything that looks like a fault. The catalog uses this to describe a path; rabosh-index uses it to bound a shredded column, and the two must agree about what a bound means.

Only numbers and text have a bound, matching the two tags the sidecar formats carry. A boolean, a byte string or a timestamp contributes nothing here — it is still present, which is a separate fact recorded separately — and the tag byte on the absent case is what lets another kind arrive later as a new id rather than a new format version.

Not thread-safe; one of these belongs to one accumulation.

Parameters

textBoundBytes

how many bytes of a string the bound may keep before truncating. Truncation widens, so a smaller limit costs precision and never correctness.

Constructors

Link copied to clipboard
constructor(textBoundBytes: Int)

Properties

Link copied to clipboard

Whether nothing bounded has been seen yet.

Functions

Link copied to clipboard
fun add(other: ValueBounds)

Widens these bounds to include everything other covers.

fun add(value: Variant)

Widens the bounds to include value, if it is of a kind that has one.

Link copied to clipboard
fun addNumber(value: BigDecimal)

Widens the numeric bound to include value.

Link copied to clipboard
fun addText(utf8: ByteArray)

Widens the text bound to include the string whose UTF-8 form is utf8.

Link copied to clipboard