MonotonicBlockPackedWriter

A writer for large monotonically increasing sequences of positive longs.

The sequence is divided into fixed-size blocks and for each block, values are modeled after a linear function f: x A x + B. The block encodes deltas from the expected values computed from this function using as few bits as possible.

Format:

  • BlockCount

  • BlockCount: ValueCount / BlockSize

  • Block:

  • Header:

  • B: the B from f: x A x + B using a zig-zag vLong

  • A: the A from f: x A x + B encoded using Float.floatToIntBits on 4 bytes

  • BitsPerValue: a variable-length int

  • Ints: if BitsPerValue is 0, then there is nothing to read and all values perfectly match the result of the function. Otherwise, these are the packed deltas from the expected value (computed from the function) using exactly BitsPerValue bits per value.

See also

Constructors

Link copied to clipboard
constructor(out: DataOutput, blockSize: Int)

Functions

Link copied to clipboard
open override fun add(l: Long)

Append a new long.

Link copied to clipboard
Link copied to clipboard
fun finish()

Flush all buffered data to disk. This instance is not usable anymore after this method has been called until .reset has been called.

Link copied to clipboard
fun ord(): Long

Return the number of values which have been added.

Link copied to clipboard
fun reset(out: DataOutput)

Reset this writer to wrap out. The block size remains unchanged.