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

Class MapType

source code

object --+    
         |    
  DataType --+
             |
            MapType

Spark SQL MapType

The data type representing dict values. A MapType object comprises three fields, keyType (a DataType), valueType (a DataType) and valueContainsNull (a bool).

The field of keyType is used to specify the type of keys in the map. The field of valueType is used to specify the type of values in the map. The field of valueContainsNull is used to specify if values of this map has None values.

For values of a MapType column, keys are not allowed to have None values.

Instance Methods
 
__init__(self, keyType, valueType, valueContainsNull=True)
Creates a MapType :param keyType: the data type of keys.
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, keyType, valueType, valueContainsNull=True)
(Constructor)

source code 

Creates a MapType :param keyType: the data type of keys. :param valueType: the data type of values. :param valueContainsNull: indicates whether values contains null values.

>>> (MapType(StringType, IntegerType)
...        == MapType(StringType, IntegerType, True))
True
>>> (MapType(StringType, IntegerType, False)
...        == MapType(StringType, FloatType))
False
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)