fletcher.algorithms.string_builder_nojit module

class fletcher.algorithms.string_builder_nojit.BitVector(initial_size: int)

Bases: object

Builder that constructs a buffer based on bit-packed chunks.

As the memory is owned by this object but we cannot override __del__, you need to explicitly call delete() to free the native memory.

Methods

expand()

Double the size of the underlying buffer and copy over the existing data.

append_false

append_true

delete

get

append_false()
append_true()
delete()
expand()

Double the size of the underlying buffer and copy over the existing data.

This allocates a new buffer and copies the data.

get(idx)
class fletcher.algorithms.string_builder_nojit.ByteVector(initial_size: int)

Bases: object

Builder that constructs a buffer based on byte-sized chunks.

As the memory is owned by this object but we cannot override __del__, you need to explicitly call delete() to free the native memory.

Methods

append(byte)

Append a single byte to the stream.

append_bytes(ptr, length)

Append a range of bytes.

append_int16(i16)

Append a signed 16bit integer.

append_int32(i32)

Append a signed 32bit integer.

append_int64(i64)

Append a signed 64bit integer.

append_uint32(i32)

Append an unsigned 32bit integer.

expand()

Double the size of the underlying buffer and copy over the existing data.

delete

get_int16

get_int32

get_int64

get_uint32

get_uint8

append(byte)

Append a single byte to the stream.

append_bytes(ptr, length)

Append a range of bytes.

append_int16(i16)

Append a signed 16bit integer.

append_int32(i32)

Append a signed 32bit integer.

append_int64(i64)

Append a signed 64bit integer.

append_uint32(i32)

Append an unsigned 32bit integer.

delete()
expand()

Double the size of the underlying buffer and copy over the existing data.

This allocates a new buffer and copies the data.

get_int16(idx)
get_int32(idx)
get_int64(idx)
get_uint32(idx)
get_uint8(idx)
class fletcher.algorithms.string_builder_nojit.StringArrayBuilder(initial_size: int)

Bases: object

Numba-based builder to construct pyarrow.StringArray instances.

As Numba doesn’t allow us to override __del__, we must always call delete to free up the used (native) memory.

Methods

append_null

append_value

delete

append_null()
append_value(ptr, length)
delete()
fletcher.algorithms.string_builder_nojit.byte_for_bits(num_bits)
fletcher.algorithms.string_builder_nojit.finalize_string_array(sba, typ) → pyarrow.lib.Array

Take a StringArrayBuilder and returns a pyarrow.StringArray. The native memory in the StringArrayBuilder is free’d during this method call and this is unusable afterwards but also doesn’t leak any memory.