DTypes

type vx_dtype

A reference-counted Vortex data type.

Dtypes in Vortex are purely logical meaning they tell you what the data is but but not the encoding in which it’s stored physically.

Copying a dtype with vx_dtype_clone is a cheap operation.

const vx_dtype *vx_dtype_clone(const vx_dtype *ptr)

Increase reference count on vx_dtype

void vx_dtype_free(const vx_dtype *ptr)

Free a vx_dtype

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(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 “element”.

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.

enumerator DTYPE_FIXED_SIZE_LIST = 9

Nested fixed-size list type.

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)

Returns the vx_ptype of a primitive.

uint8_t vx_dtype_decimal_precision(const vx_dtype *dtype)

Returns the precision of a decimal.

int8_t vx_dtype_decimal_scale(const vx_dtype *dtype)

Returns the scale of a decimal.

const vx_struct_fields *vx_dtype_struct_dtype(const vx_dtype *dtype)

If “dtype” is DTYPE_STRUCT, return owned vx_struct_fields for this struct, return NULL otherwise. Returned vx_struct_fields must be released with vx_struct_fields_free.

const vx_dtype *vx_dtype_list_element(const vx_dtype *dtype)

If “dtype” is DTYPE_LIST, return its element dtype, return NULL otherwise.

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.

void vx_struct_fields_free(const vx_struct_fields *ptr)

Free a vx_struct_fields

uint64_t vx_struct_fields_nfields(const vx_struct_fields *fields)

Return the number of fields in the struct dtype.

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

Return an owned dtype of the field at a given index. Returns NULL if index is out of bounds or if dtype cannot be parsed.

vx_view vx_struct_fields_field_name(const vx_struct_fields *fields, size_t idx)

Return field name at a given index. If index is out of bounds, returns {NULL, 0}.

Returned view is valid as long as “dtype” is valid.

Struct Fields Builder

type vx_struct_fields_builder

Builder for creating a vx_struct_fields.

void vx_struct_fields_builder_free(const vx_struct_fields_builder *ptr)

Free a vx_struct_fields_builder

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, vx_view name, const vx_dtype *dtype, vx_error **error_out)

Add a field to the struct dtype builder.

“name” is copied. Takes ownership of “dtype”. Caller must free or finalize the builder.

vx_struct_fields *vx_struct_fields_builder_finalize(vx_struct_fields_builder *builder)

Finalize the struct dtype builder, returning vx_struct_fields.

Takes ownership of “builder”.