nxcals.api.common.utils.array_utils.ArrayType

class nxcals.api.common.utils.array_utils.ArrayType(elementType: DataType, containsNull: bool = True)

Array data type.

Parameters:
  • elementType (DataType) – DataType of each element in the array.

  • containsNull (bool, optional) – whether the array can contain null (None) values.

Examples

>>> from pyspark.sql.types import ArrayType, StringType, StructField, StructType

The below example demonstrates how to create class:ArrayType:

>>> arr = ArrayType(StringType())

The array can contain null (None) values by default:

>>> ArrayType(StringType()) == ArrayType(StringType(), True)
True
>>> ArrayType(StringType(), False) == ArrayType(StringType())
False

Methods

ArrayType.__init__(elementType[, containsNull])

ArrayType.fromDDL(ddl)

Creates DataType for a given DDL-formatted string.

ArrayType.fromInternal(obj)

Converts an internal SQL object into a native Python object.

ArrayType.fromJson(json[, fieldPath, ...])

ArrayType.json()

ArrayType.jsonValue()

ArrayType.needConversion()

Does this type needs conversion between Python object and internal SQL object.

ArrayType.simpleString()

ArrayType.toInternal(obj)

Converts a Python object into an internal SQL object.

ArrayType.toNullable()

Returns the same data type but set all nullability fields are true (StructField.nullable, ArrayType.containsNull, and MapType.valueContainsNull).

ArrayType.typeName()