Extension#
Extension Type classes#
- classBool8Type:publicarrow::ExtensionType#
Bool8 is an alternate representation for boolean arrays using 8 bits instead of 1 bit per value.
The underlying storage type is int8.
Public Functions
- inlinevirtualstd::stringextension_name()constoverride#
Unique name of extension type used to identify type for serialization.
- Returns:
the string name of the extension
- virtualstd::stringToString(boolshow_metadata=false)constoverride#
A string representation of the type, including any children.
- virtualboolExtensionEquals(constExtensionType&other)constoverride#
Determine if two instances of the same extension types are equal.
Invoked fromExtensionType::Equals
- Parameters:
other –[in] the type to compare this type with
- Returns:
bool true if type instances are equal
- virtualstd::stringSerialize()constoverride#
Create a serialized representation of the extension type’s metadata.
The storage type will be handled automatically in IPC code paths
- Returns:
the serialized representation
- virtualResult<std::shared_ptr<DataType>>Deserialize(std::shared_ptr<DataType>storage_type,conststd::string&serialized_data)constoverride#
Create an instance of theExtensionType given the actual storage type and the serialized representation.
- Parameters:
storage_type –[in] the physical storage type of the extension
serialized_data –[in] the serialized representation produced by Serialize
- virtualstd::shared_ptr<Array>MakeArray(std::shared_ptr<ArrayData>data)constoverride#
Create aBool8Array fromArrayData.
- inlinevirtualstd::stringextension_name()constoverride#
- classFixedShapeTensorType:publicarrow::ExtensionType#
Concrete type class for constant-sizeTensor data.
This is a canonical arrow extension type. See:https://arrow.apache.org/docs/format/CanonicalExtensions.html
Public Functions
- inlinevirtualstd::stringextension_name()constoverride#
Unique name of extension type used to identify type for serialization.
- Returns:
the string name of the extension
- virtualstd::stringToString(boolshow_metadata=false)constoverride#
A string representation of the type, including any children.
- inlinesize_tndim()const#
Number of dimensions of tensor elements.
- inlineconststd::vector<int64_t>&shape()const#
Shape of tensor elements.
- conststd::vector<int64_t>&strides()#
Strides of tensor elements.
Strides state offset in bytes between adjacent elements along each dimension. In case permutation is non-empty strides are computed from permuted tensor element’s shape.
- inlineconststd::vector<int64_t>&permutation()const#
Permutation mapping from logical to physical memory layout of tensor elements.
- inlineconststd::vector<std::string>&dim_names()const#
Dimension names of tensor elements. Dimensions are ordered physically.
- virtualboolExtensionEquals(constExtensionType&other)constoverride#
Determine if two instances of the same extension types are equal.
Invoked fromExtensionType::Equals
- Parameters:
other –[in] the type to compare this type with
- Returns:
bool true if type instances are equal
- virtualstd::stringSerialize()constoverride#
Create a serialized representation of the extension type’s metadata.
The storage type will be handled automatically in IPC code paths
- Returns:
the serialized representation
- virtualResult<std::shared_ptr<DataType>>Deserialize(std::shared_ptr<DataType>storage_type,conststd::string&serialized_data)constoverride#
Create an instance of theExtensionType given the actual storage type and the serialized representation.
- Parameters:
storage_type –[in] the physical storage type of the extension
serialized_data –[in] the serialized representation produced by Serialize
- virtualstd::shared_ptr<Array>MakeArray(std::shared_ptr<ArrayData>data)constoverride#
Create aFixedShapeTensorArray fromArrayData.
Public Static Functions
- staticResult<std::shared_ptr<Tensor>>MakeTensor(conststd::shared_ptr<ExtensionScalar>&scalar)#
Create aTensor from anExtensionScalar from aFixedShapeTensorArray.
This method will return aTensor fromExtensionScalar with strides derived from shape and permutation ofFixedShapeTensorType. Shape and dim_names will be permuted according to permutation stored in theFixedShapeTensorType metadata.
- staticResult<std::shared_ptr<DataType>>Make(conststd::shared_ptr<DataType>&value_type,conststd::vector<int64_t>&shape,conststd::vector<int64_t>&permutation={},conststd::vector<std::string>&dim_names={})#
Create aFixedShapeTensorType instance.
- inlinevirtualstd::stringextension_name()constoverride#
- classOpaqueType:publicarrow::ExtensionType#
Opaque is a placeholder for a type from an external (usually non-Arrow) system that could not be interpreted.
Public Functions
- inlineexplicitOpaqueType(std::shared_ptr<DataType>storage_type,std::stringtype_name,std::stringvendor_name)#
Construct anOpaqueType.
- Parameters:
storage_type –[in] The underlying storage type. Should bearrow::null if there is no data.
type_name –[in] The name of the type in the external system.
vendor_name –[in] The name of the external system.
- inlinevirtualstd::stringextension_name()constoverride#
Unique name of extension type used to identify type for serialization.
- Returns:
the string name of the extension
- virtualstd::stringToString(boolshow_metadata)constoverride#
A string representation of the type, including any children.
- virtualboolExtensionEquals(constExtensionType&other)constoverride#
Determine if two instances of the same extension types are equal.
Invoked fromExtensionType::Equals
- Parameters:
other –[in] the type to compare this type with
- Returns:
bool true if type instances are equal
- virtualstd::stringSerialize()constoverride#
Create a serialized representation of the extension type’s metadata.
The storage type will be handled automatically in IPC code paths
- Returns:
the serialized representation
- virtualResult<std::shared_ptr<DataType>>Deserialize(std::shared_ptr<DataType>storage_type,conststd::string&serialized_data)constoverride#
Create an instance of theExtensionType given the actual storage type and the serialized representation.
- Parameters:
storage_type –[in] the physical storage type of the extension
serialized_data –[in] the serialized representation produced by Serialize
- virtualstd::shared_ptr<Array>MakeArray(std::shared_ptr<ArrayData>data)constoverride#
Create anOpaqueArray fromArrayData.
- inlineexplicitOpaqueType(std::shared_ptr<DataType>storage_type,std::stringtype_name,std::stringvendor_name)#
- classJsonExtensionType:publicarrow::ExtensionType#
Concrete type class for variable-size JSON data, utf8-encoded.
Public Functions
- inlinevirtualstd::stringextension_name()constoverride#
Unique name of extension type used to identify type for serialization.
- Returns:
the string name of the extension
- virtualboolExtensionEquals(constExtensionType&other)constoverride#
Determine if two instances of the same extension types are equal.
Invoked fromExtensionType::Equals
- Parameters:
other –[in] the type to compare this type with
- Returns:
bool true if type instances are equal
- virtualResult<std::shared_ptr<DataType>>Deserialize(std::shared_ptr<DataType>storage_type,conststd::string&serialized_data)constoverride#
Create an instance of theExtensionType given the actual storage type and the serialized representation.
- Parameters:
storage_type –[in] the physical storage type of the extension
serialized_data –[in] the serialized representation produced by Serialize
- virtualstd::stringSerialize()constoverride#
Create a serialized representation of the extension type’s metadata.
The storage type will be handled automatically in IPC code paths
- Returns:
the serialized representation
- virtualstd::shared_ptr<Array>MakeArray(std::shared_ptr<ArrayData>data)constoverride#
Wrap built-inArray type in a user-definedExtensionArray instance.
- Parameters:
data –[in] the physical storage for the extension type
- inlinevirtualstd::stringextension_name()constoverride#
- classUuidType:publicarrow::ExtensionType#
UuidType is a canonical arrow extension type for UUIDs.
UUIDs are stored as FixedSizeBinary(16) with big-endian notation and this does not interpret the bytes in any way. Specific UUID version is not required or guaranteed.
Public Functions
- inlinevirtualstd::stringextension_name()constoverride#
Unique name of extension type used to identify type for serialization.
- Returns:
the string name of the extension
- virtualstd::stringToString(boolshow_metadata=false)constoverride#
A string representation of the type, including any children.
- virtualboolExtensionEquals(constExtensionType&other)constoverride#
Determine if two instances of the same extension types are equal.
Invoked fromExtensionType::Equals
- Parameters:
other –[in] the type to compare this type with
- Returns:
bool true if type instances are equal
- virtualResult<std::shared_ptr<DataType>>Deserialize(std::shared_ptr<DataType>storage_type,conststd::string&serialized)constoverride#
Create an instance of theExtensionType given the actual storage type and the serialized representation.
- Parameters:
storage_type –[in] the physical storage type of the extension
serialized_data –[in] the serialized representation produced by Serialize
- inlinevirtualstd::stringSerialize()constoverride#
Create a serialized representation of the extension type’s metadata.
The storage type will be handled automatically in IPC code paths
- Returns:
the serialized representation
- inlinevirtualstd::stringextension_name()constoverride#
Extension Array classes#
- classBool8Array:publicarrow::ExtensionArray#
Bool8 is an alternate representation for boolean arrays using 8 bits instead of 1 bit per value.
The underlying storage type is int8.
Public Functions
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
Construct anExtensionArray from anArrayData.
TheArrayData must have the rightExtensionType.
- ExtensionArray(conststd::shared_ptr<DataType>&type,conststd::shared_ptr<Array>&storage)#
Construct anExtensionArray from a type and the underlying storage.
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
- classFixedShapeTensorArray:publicarrow::ExtensionArray#
Public Functions
- constResult<std::shared_ptr<Tensor>>ToTensor()const#
Create aTensor fromFixedShapeTensorArray.
This method will create aTensor from aFixedShapeTensorArray, setting its first dimension as length equal to theFixedShapeTensorArray’s length and the remaining dimensions as theFixedShapeTensorType’s shape. Shape and dim_names will be permuted according to permutation stored in theFixedShapeTensorType metadata.
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
Construct anExtensionArray from anArrayData.
TheArrayData must have the rightExtensionType.
- ExtensionArray(conststd::shared_ptr<DataType>&type,conststd::shared_ptr<Array>&storage)#
Construct anExtensionArray from a type and the underlying storage.
Public Static Functions
- staticResult<std::shared_ptr<FixedShapeTensorArray>>FromTensor(conststd::shared_ptr<Tensor>&tensor)#
Create aFixedShapeTensorArray from aTensor.
This method will create aFixedShapeTensorArray from aTensor, taking its first dimension as the number of elements in the resulting array and the remaining dimensions as the shape of the individual tensors. IfTensor provides strides, they will be used to determine dimension permutation. Otherwise, row-major layout (i.e. no permutation) will be assumed.
- Parameters:
tensor –[in] TheTensor to convert to aFixedShapeTensorArray
- constResult<std::shared_ptr<Tensor>>ToTensor()const#
- classOpaqueArray:publicarrow::ExtensionArray#
Opaque is a wrapper for (usually binary) data from an external (often non-Arrow) system that could not be interpreted.
Public Functions
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
Construct anExtensionArray from anArrayData.
TheArrayData must have the rightExtensionType.
- ExtensionArray(conststd::shared_ptr<DataType>&type,conststd::shared_ptr<Array>&storage)#
Construct anExtensionArray from a type and the underlying storage.
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
- classUuidArray:publicarrow::ExtensionArray#
UuidArray stores array of UUIDs.
Underlying storage type is FixedSizeBinary(16).
Public Functions
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#
Construct anExtensionArray from anArrayData.
TheArrayData must have the rightExtensionType.
- ExtensionArray(conststd::shared_ptr<DataType>&type,conststd::shared_ptr<Array>&storage)#
Construct anExtensionArray from a type and the underlying storage.
- explicitExtensionArray(conststd::shared_ptr<ArrayData>&data)#

