ExtensionType class
Methods
TheExtensionType class inherits fromDataType, but also definesextra methods specific to extension types:
$storage_type(): Returns the underlyingDataType used to storevalues.$storage_id(): Returns theType identifier corresponding to the$storage_type().$extension_name(): Returns the extension name.$extension_metadata(): Returns the serialized version of the extensionmetadata as araw()vector.$extension_metadata_utf8(): Returns the serialized version of theextension metadata as a UTF-8 encoded string.$WrapArray(array): Wraps a storageArray into anExtensionArraywith this extension type.
In addition, subclasses may override the following methods to customizethe behaviour of extension classes.
$deserialize_instance(): This method is called when a new ExtensionTypeis initialized and is responsible for parsing and validatingthe serialized extension_metadata (araw()vector)such that its contents can be inspected by fields and/or methodsof the R6 ExtensionType subclass. Implementations must also check thestorage_typeto make sure it is compatible with the extension type.$as_vector(extension_array): Convert anArray orChunkedArray to an Rvector. This method is called byas.vector()onExtensionArrayobjects, when aRecordBatch containing anExtensionArray isconverted to adata.frame(), or when aChunkedArray (e.g., a columnin aTable) is converted to an R vector. The default method returns theconverted storage array.$ToString()Return a string representation that will be printedto the console when this type or an Array of this type is printed.