nxcals.api.common.utils.array_utils.StructType.toNullable
- StructType.toNullable() StructType
Returns the same data type but set all nullability fields are true (StructField.nullable, ArrayType.containsNull, and MapType.valueContainsNull).
Added in version 4.0.0.
- Return type:
Examples
Example 1: Simple nullability conversion
>>> StructType([StructField("a", IntegerType(), nullable=False)]).toNullable() StructType([StructField('a', IntegerType(), True)])
Example 2: Nested nullability conversion
>>> StructType([ ... StructField("a", ... StructType([ ... StructField("b", IntegerType(), nullable=False), ... StructField("c", StructType([ ... StructField("d", IntegerType(), nullable=False) ... ])) ... ]), ... nullable=False) ... ]).toNullable() StructType([StructField('a', StructType([StructField('b', IntegerType(), True), StructField('c', StructType([StructField('d', IntegerType(), True)]), True)]), True)])