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 can have null values.

See Also:
  • Constructor Details

    • MapType

      public MapType(DataType keyType, DataType valueType, boolean valueContainsNull)

    • MapType

      public MapType()

      No-arg constructor for kryo.

  • Method Details

    • apply

      Construct a MapType object with the given key type and value type. The valueContainsNull is 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:
      defaultSize in class DataType
      Returns:
      (undocumented)
    • simpleString

      public String simpleString()

      Description copied from class: DataType

      Readable string representation for the type.

      Overrides:
      simpleString in class DataType
    • catalogString

      public String catalogString()

      Description copied from class: DataType

      String representation for the type saved in external catalogs.

      Overrides:
      catalogString in class DataType
    • sql

      Overrides:
      sql in class DataType
    • toNullable

      Returns the same data type but set all nullability fields are true (StructField.nullable, ArrayType.containsNull, and MapType.valueContainsNull).

      Returns:
      (undocumented)
      Since:
      4.0.0