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.
Returns the type category
Returns a string name of the type, omitting any child fields
Whether to include metadata in the output
Returns a string representation of the type, including any children
Whether to compare metadata
Returns whether the types are equal. Types that are logically convertible are NOT considered equal
Returns the number of children fields associated with this type
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:
Static constexpr type identifier
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)
Number of significant digits (1-38)
Number of digits after decimal point (can be negative)
Constructs a Decimal128Type. Aborts on invalid input
Make
Result<std::shared_ptr<DataType>>
Number of significant digits
Number of digits after decimal point
Constructs a Decimal128Type. Returns error on invalid input
Returns the precision (number of significant digits)
Returns the scale (number of digits after decimal point)
Binary Types
BinaryType
Variable-size binary data with 32-bit 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.
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).
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;
Fixed byte width of each value
Constructs a FixedSizeBinaryType
Returns the fixed byte width
Nested Types
ListType
Variable-length list type with 32-bit offsets.
class ListType : public BaseListType;
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
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;
value_type
std::shared_ptr<DataType>
required
Type of list elements
Fixed length of each list
Constructs a FixedSizeListType
Returns the fixed list size
StructType
Struct type with named fields.
class StructType : public NestedType;
fields
const FieldVector&
required
Vector of struct fields
Constructs a StructType
name
const std::string&
required
Field name
Returns the field with the given name, or nullptr if not found
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>>
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;
key_type
std::shared_ptr<DataType>
required
Type of map keys
item_type
std::shared_ptr<DataType>
required
Type of map values
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
Returns whether keys are sorted
Field
Combination of a field name and data type, with optional metadata.
type
std::shared_ptr<DataType>
required
Field data type
Whether field can contain nulls (default: true)
metadata
std::shared_ptr<const KeyValueMetadata>
Optional metadata
Constructs a Field
type
std::shared_ptr<DataType>
Returns the field data type
Returns whether the field is nullable
type
std::shared_ptr<DataType>
required
New type
Returns a copy of this field with the replaced type
name
const std::string&
required
New name
Returns a copy of this field with the replaced name
metadata
std::shared_ptr<const KeyValueMetadata>
required
New metadata
Returns a copy of this field with the given metadata attached
Whether to check metadata equality
Indicates if fields are equal