package granary

  1. Overview
  2. Docs
Pure-OCaml SQL engine

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.0.3.tar.gz
sha256=8b18780ea373be48301d9f333925860a2f9110fc0ac28684295118d72b65a67e
sha512=25ca3c9c5e2b528704a542502e0f37dc33ba003f65622d969b8c2b800778585f8ef0cf89b36e6679832e3993e8303aecddfc662742baf7044d6afe4a796b8f11

doc/granary.encoding/Granary_encoding/Null_bitmap/index.html

Module Granary_encoding.Null_bitmapSource

Bitmap helpers for null-mask encoding.

Used by Granary_columnar.Col for columnar null bitmaps. Intended to also replace the inline bitmap logic in Granary_encoding.Row once the API is adapted (see issue #372).

Sourcemodule Bigarray = Bigarray

pack_bits bits n packs the first n elements of bits into a big-endian bitmask byte string. Each byte encodes 8 entries: bit 0 of byte 0 = bits0, bit 1 = bits1, etc.

Sourceval pack_bits_into : Buffer.t -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> int -> unit

pack_bits_into buf bits n writes a packed bitmask directly into buf, one byte per 8 entries, without materialising an intermediate Bytes.t.

Sourceval unpack_bits : bytes -> int -> int -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t

unpack_bits buf off n reads ceil(n/8) bytes from buf starting at off and unpacks them into a fresh bigarray of length n.

Sourceval pack_bits_of_bools : (int -> bool) -> int -> bytes

pack_bits_of_bools is_null n packs the predicate is_null applied to indices 0, n-1 into a big-endian bitmask byte string. Each byte encodes 8 entries: bit 0 of byte 0 = is_null(0), bit 1 = is_null(1), etc.

Sourceval unpack_bits_to_bools : bytes -> int -> int -> bool array

unpack_bits_to_bools buf off n reads ceil(n/8) bytes from buf at off and returns a bool array of length n where element i is true iff bit i of the bitmask is set.