DTypes

type vx_dtype

A Vortex data type.

Data types in Vortex are purely logical, meaning they confer no information about how the data is physically stored.

const vx_dtype *vx_dtype_clone(const vx_dtype *ptr)

Clone a borrowed vx_dtype, returning an owned vx_dtype.

Must be released with vx_dtype_free().

void vx_dtype_free(const vx_dtype *ptr)

Free an owned vx_dtype object.

Factories

const vx_dtype *vx_dtype_new_null(void)

Create a new null data type.

const vx_dtype *vx_dtype_new_bool(bool is_nullable)

Create a new boolean data type.

const vx_dtype *vx_dtype_new_primitive(vx_ptype ptype, bool is_nullable)

Create a new primitive data type.

const vx_dtype *vx_dtype_new_decimal(uint8_t precision, int8_t scale, bool is_nullable)

Create a new decimal data type.

const vx_dtype *vx_dtype_new_utf8(bool is_nullable)

Create a new variable length UTF-8 data type.

const vx_dtype *vx_dtype_new_binary(bool is_nullable)

Create a new variable length binary data type.

const vx_dtype *vx_dtype_new_struct(const vx_struct_fields *struct_dtype, bool is_nullable)

Create a new struct data type.

Takes ownership of the struct_dtype pointer.

const vx_dtype *vx_dtype_new_list(const vx_dtype *element, bool is_nullable)

Create a new list data type.

Takes ownership of the element pointer.

Properties

enum vx_dtype_variant

The variant tag for a Vortex data type.

enumerator DTYPE_NULL = 0

Null type

enumerator DTYPE_BOOL = 1

Boolean type

enumerator DTYPE_PRIMITIVE = 2

Primitive types (e.g., u8, i16, f32, etc.)

enumerator DTYPE_UTF8 = 3

Variable-length UTF-8 string type

enumerator DTYPE_BINARY = 4

Variable-length binary data type

enumerator DTYPE_STRUCT = 5

Nested struct type

enumerator DTYPE_LIST = 6

Nested list type

enumerator DTYPE_EXTENSION = 7

User-defined extension type

enumerator DTYPE_DECIMAL = 8

Decimal type with fixed precision and scale

vx_dtype_variant vx_dtype_get_variant(const vx_dtype *dtype)

Get the variant of a vx_dtype.

bool vx_dtype_is_nullable(const vx_dtype *dtype)

Return whether the given vx_dtype is nullable.

vx_ptype vx_dtype_primitive_ptype(const vx_dtype *dtype)

Return the vx_ptype of a primitive data type.

uint8_t vx_dtype_decimal_precision(const vx_dtype *dtype)

Return the precision of a decimal data type.

int8_t vx_dtype_decimal_scale(const vx_dtype *dtype)

Return the scale of a decimal data type.

const vx_struct_fields *vx_dtype_struct_dtype(const vx_dtype *dtype)

Return a borrowed reference to the vx_struct_fields of a struct data type.

const vx_dtype *vx_dtype_list_element(const vx_dtype *dtype)

Return a borrowed reference to the element typee of a list data type.

PType

enum vx_ptype

Variant enum for Vortex primitive types.

enumerator PTYPE_U8 = 0

Unsigned 8-bit integer

enumerator PTYPE_U16 = 1

Unsigned 16-bit integer

enumerator PTYPE_U32 = 2

Unsigned 32-bit integer

enumerator PTYPE_U64 = 3

Unsigned 64-bit integer

enumerator PTYPE_I8 = 4

Signed 8-bit integer

enumerator PTYPE_I16 = 5

Signed 16-bit integer

enumerator PTYPE_I32 = 6

Signed 32-bit integer

enumerator PTYPE_I64 = 7

Signed 64-bit integer

enumerator PTYPE_F16 = 8

16-bit floating point number

enumerator PTYPE_F32 = 9

32-bit floating point number

enumerator PTYPE_F64 = 10

64-bit floating point number

Struct Fields

type vx_struct_fields

Represents a Vortex struct data type, without top-level nullability.

const vx_struct_fields *vx_struct_fields_clone(const vx_struct_fields *ptr)

Clone a borrowed vx_struct_fields, returning an owned vx_struct_fields.

Must be released with vx_struct_fields_free().

void vx_struct_fields_free(const vx_struct_fields *ptr)

Free an owned vx_struct_fields object.

size_t vx_struct_fields_nfields(const vx_struct_fields *dtype)

Return the number of fields in the struct dtype.

const vx_dtype *vx_struct_fields_field_dtype(const vx_struct_fields *dtype, size_t idx)

Returns an owned reference to the dtype of the field at the given index.

The return type is owned since struct dtypes can be lazily parsed from a binary format, in which case it’s not possible to return a borrowed reference to the field dtype.

const vx_string *vx_struct_fields_field_name(const vx_struct_fields *dtype, size_t idx)

Return a borrowed reference to the name of the field at the given index.

Struct Fields Builder

type vx_struct_fields_builder

Builder for creating a vx_struct_fields.

void vx_struct_fields_builder_free(vx_struct_fields_builder *ptr)

Free an owned vx_struct_fields_builder object.

vx_struct_fields_builder *vx_struct_fields_builder_new(void)

Create a new struct dtype builder.

void vx_struct_fields_builder_add_field(vx_struct_fields_builder *builder, const vx_string *name, const vx_dtype *dtype)

Add a field to the struct dtype builder.

Takes ownership of both the name and dtype pointers. Must either free or finalize the builder.

const vx_struct_fields *vx_struct_fields_builder_finalize(vx_struct_fields_builder *builder)

Finalize the struct dtype builder, returning a new vx_struct_fields.

Takes ownership of the builder.