Skip to main content

Data Type Classes

Data types in Arrow represent the logical types of data. All data types are immutable.

Base Classes

DataType

Base class for all data types.
class DataType
id
Type::type
Returns the type category
name
std::string
Returns a string name of the type, omitting any child fields
ToString
std::string
show_metadata
bool
Whether to include metadata in the output
Returns a string representation of the type, including any children
Equals
bool
other
const DataType&
required
Type to compare with
check_metadata
bool
Whether to compare metadata
Returns whether the types are equal. Types that are logically convertible are NOT considered equal
num_fields
int
Returns the number of children fields associated with this type
field
std::shared_ptr<Field>
i
int
required
Field index
Returns the child field at index i

Numeric Types

Integer Types

Fixed-width integer types.
class Int8Type;    // Signed 8-bit integer
class Int16Type;   // Signed 16-bit integer
class Int32Type;   // Signed 32-bit integer
class Int64Type;   // Signed 64-bit integer
class UInt8Type;   // Unsigned 8-bit integer
class UInt16Type;  // Unsigned 16-bit integer
class UInt32Type;  // Unsigned 32-bit integer
class UInt64Type;  // Unsigned 64-bit integer
Each type provides:
type_id
Type::type
Static constexpr type identifier
c_type
typename
Corresponding C type (int8_t, int16_t, etc.)

Floating Point Types

class HalfFloatType;  // 16-bit floating-point
class FloatType;      // 32-bit floating-point (C float)
class DoubleType;     // 64-bit floating-point (C double)

Boolean Type

class BooleanType;    // Boolean (1-bit)

Decimal Types

Fixed-point decimal types with specified precision and scale.
class Decimal32Type;   // 32-bit decimal (max precision: 9)
class Decimal64Type;   // 64-bit decimal (max precision: 18)
class Decimal128Type;  // 128-bit decimal (max precision: 38)
class Decimal256Type;  // 256-bit decimal (max precision: 76)
Decimal128Type
precision
int32_t
required
Number of significant digits (1-38)
scale
int32_t
required
Number of digits after decimal point (can be negative)
Constructs a Decimal128Type. Aborts on invalid input
Make
Result<std::shared_ptr<DataType>>
precision
int32_t
required
Number of significant digits
scale
int32_t
required
Number of digits after decimal point
Constructs a Decimal128Type. Returns error on invalid input
precision
int32_t
Returns the precision (number of significant digits)
scale
int32_t
Returns the scale (number of digits after decimal point)

Binary Types

BinaryType

Variable-size binary data with 32-bit offsets.
class BinaryType;
offset_type
int32_t
Type used for offsets

StringType

Variable-size UTF-8 string data with 32-bit offsets.
class StringType : public BinaryType;

LargeBinaryType

Variable-size binary data with 64-bit offsets.
class LargeBinaryType;

LargeStringType

Variable-size UTF-8 string data with 64-bit offsets.
class LargeStringType : public LargeBinaryType;

BinaryViewType

Variable-size binary data with inline optimization for small values (12 bytes or fewer).
class BinaryViewType;
Small strings are stored inline, while larger strings are stored in separate buffers with a 4-byte prefix cached inline.

StringViewType

Variable-size UTF-8 string data with inline optimization.
class StringViewType : public BinaryViewType;

FixedSizeBinaryType

Fixed-size binary data.
class FixedSizeBinaryType;
FixedSizeBinaryType
byte_width
int32_t
required
Fixed byte width of each value
Constructs a FixedSizeBinaryType
byte_width
int32_t
Returns the fixed byte width

Nested Types

ListType

Variable-length list type with 32-bit offsets.
class ListType : public BaseListType;
ListType
value_type
std::shared_ptr<DataType>
required
Type of list elements
Constructs a ListType. List can contain any other logical value type
value_type
std::shared_ptr<DataType>
Returns the list element type
value_field
std::shared_ptr<Field>
Returns the list element field

LargeListType

Variable-length list type with 64-bit offsets.
class LargeListType : public BaseListType;

FixedSizeListType

Fixed-size list type where all lists have the same length.
class FixedSizeListType : public BaseListType;
FixedSizeListType
value_type
std::shared_ptr<DataType>
required
Type of list elements
list_size
int32_t
required
Fixed length of each list
Constructs a FixedSizeListType
list_size
int32_t
Returns the fixed list size

StructType

Struct type with named fields.
class StructType : public NestedType;
StructType
fields
const FieldVector&
required
Vector of struct fields
Constructs a StructType
GetFieldByName
std::shared_ptr<Field>
name
const std::string&
required
Field name
Returns the field with the given name, or nullptr if not found
GetFieldIndex
int
name
const std::string&
required
Field name
Returns the field index, or -1 if not found or if there are multiple fields with the same name
AddField
Result<std::shared_ptr<StructType>>
i
int
required
Position to insert field
field
const std::shared_ptr<Field>&
required
Field to add
Creates a new StructType with field added at given index

MapType

Map type representing key-value pairs.
class MapType : public ListType;
MapType
key_type
std::shared_ptr<DataType>
required
Type of map keys
item_type
std::shared_ptr<DataType>
required
Type of map values
keys_sorted
bool
Whether keys are sorted
Constructs a MapType. Maps can be recursively nested
key_type
std::shared_ptr<DataType>
Returns the map key type
item_type
std::shared_ptr<DataType>
Returns the map item (value) type
keys_sorted
bool
Returns whether keys are sorted

Field

Combination of a field name and data type, with optional metadata.
class Field;
Field
name
std::string
required
Field name
type
std::shared_ptr<DataType>
required
Field data type
nullable
bool
Whether field can contain nulls (default: true)
metadata
std::shared_ptr<const KeyValueMetadata>
Optional metadata
Constructs a Field
name
const std::string&
Returns the field name
type
std::shared_ptr<DataType>
Returns the field data type
nullable
bool
Returns whether the field is nullable
WithType
std::shared_ptr<Field>
type
std::shared_ptr<DataType>
required
New type
Returns a copy of this field with the replaced type
WithName
std::shared_ptr<Field>
name
const std::string&
required
New name
Returns a copy of this field with the replaced name
WithMetadata
std::shared_ptr<Field>
metadata
std::shared_ptr<const KeyValueMetadata>
required
New metadata
Returns a copy of this field with the given metadata attached
Equals
bool
other
const Field&
required
Field to compare with
check_metadata
bool
Whether to check metadata equality
Indicates if fields are equal

Build docs developers (and LLMs) love