Package org.apache.spark.sql.types
Class MapType
Object
org.apache.spark.sql.types.DataType
org.apache.spark.sql.types.MapType
- All Implemented Interfaces:
Serializable,scala.Equals,scala.Product
The data type for Maps. Keys in a map are not allowed to have
null values.
Please use DataTypes.createMapType() to create a specific instance.
param: keyType
The data type of map keys.
param: valueType
The data type of map values.
param: valueContainsNull
Indicates if map values have null values.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MapTypeConstruct aMapTypeobject with the given key type and value type.String representation for the type saved in external catalogs.intThe default size of a value of the MapType is (the default size of the key type + the default size of the value type).keyType()Readable string representation for the type.sql()Returns the same data type but set all nullability fields are true (StructField.nullable,ArrayType.containsNull, andMapType.valueContainsNull).booleanMethods inherited from class org.apache.spark.sql.types.DataType
COLLATIONS_METADATA_KEY, equalsIgnoreCaseAndNullability, equalsIgnoreNullability, equalsStructurally, equalsStructurallyByName, fromDDL, fromJson, json, parseTypeWithFallback, prettyJson, typeNameMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface scala.Equals
canEqual, equalsMethods inherited from interface scala.Product
productArity, productElement, productElementName, productElementNames, productIterator, productPrefix
-
Constructor Details
-
MapType
-
MapType
public MapType()No-arg constructor for kryo.
-
-
Method Details
-
apply
Construct aMapTypeobject with the given key type and value type. ThevalueContainsNullis true.- Parameters:
keyType- (undocumented)valueType- (undocumented)- Returns:
- (undocumented)
-
keyType
-
valueType
-
valueContainsNull
public boolean valueContainsNull() -
defaultSize
public int defaultSize()The default size of a value of the MapType is (the default size of the key type + the default size of the value type). We assume that there is only 1 element on average in a map. See SPARK-18853.- Specified by:
defaultSizein classDataType- Returns:
- (undocumented)
-
simpleString
Description copied from class:DataTypeReadable string representation for the type.- Overrides:
simpleStringin classDataType
-
catalogString
Description copied from class:DataTypeString representation for the type saved in external catalogs.- Overrides:
catalogStringin classDataType
-
sql
-
toNullable
Returns the same data type but set all nullability fields are true (StructField.nullable,ArrayType.containsNull, andMapType.valueContainsNull).- Returns:
- (undocumented)
- Since:
- 4.0.0
-