NestedExtensionArray.is_input_pa_type_supported

NestedExtensionArray.is_input_pa_type_supported#

classmethod NestedExtensionArray.is_input_pa_type_supported(pa_type: DataType) → bool[source]#

Check whether a pyarrow data type is supported by the constructor.

Calling this method is cheaper than trying to construct the array, because data transformations are avoided.

Parameters:

pa_type (pyarrow.DataType) – The pyarrow data type to check for compatibility with NestedExtensionArray.

Returns:

True if pa_type is a supported input type for NestedExtensionArray, False otherwise.

Return type:

bool

Examples

Check support for a list-of-structs type:

>>> import pyarrow as pa
>>> value_type = pa.struct([("a", pa.int64())])
>>> pa_type = pa.list_(value_type)
>>> NestedExtensionArray.is_input_pa_type_supported(pa_type)
True

Check support for an unsupported primitive type:

>>> NestedExtensionArray.is_input_pa_type_supported(pa.int64())
False