pyspark.sql.types.
ArrayType
Array data type.
DataType
DataType of each element in the array.
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
fromInternal(obj)
fromInternal
Converts an internal SQL object into a native Python object.
fromJson(json)
fromJson
json()
json
jsonValue()
jsonValue
needConversion()
needConversion
Does this type needs conversion between Python object and internal SQL object.
simpleString()
simpleString
toInternal(obj)
toInternal
Converts a Python object into an internal SQL object.
typeName()
typeName
Methods Documentation
This is used to avoid the unnecessary conversion for ArrayType/MapType/StructType.