Package pyspark :: Module sql :: Class StructField
[frames] | no frames]

Class StructField

source code

object --+    
         |    
  DataType --+
             |
            StructField

Spark SQL StructField

Represents a field in a StructType. A StructField object comprises three fields, name (a string), dataType (a DataType) and nullable (a bool). The field of name is the name of a StructField. The field of dataType specifies the data type of a StructField.

The field of nullable specifies if values of a StructField can contain None values.

Instance Methods
 
__init__(self, name, dataType, nullable)
Creates a StructField :param name: the name of this field.
source code
 
__repr__(self)
repr(x)
source code

Inherited from DataType: __eq__, __hash__, __ne__

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, name, dataType, nullable)
(Constructor)

source code 
Creates a StructField
:param name: the name of this field.
:param dataType: the data type of this field.
:param nullable: indicates whether values of this field
                 can be null.

>>> (StructField("f1", StringType, True)
...      == StructField("f1", StringType, True))
True
>>> (StructField("f1", StringType, True)
...      == StructField("f2", StringType, True))
False

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)