No-arg constructor for kryo.
Creates a new StructType by adding a new field and specifying metadata where the dataType is specified as a String.
Creates a new StructType by adding a new field and specifying metadata where the dataType is specified as a String.
val struct = (new StructType) .add("a", "int", true, Metadata.empty) .add("b", "long", false, Metadata.empty) .add("c", "string", true, Metadata.empty)
Creates a new StructType by adding a new field with no metadata where the dataType is specified as a String.
Creates a new StructType by adding a new field with no metadata where the dataType is specified as a String.
val struct = (new StructType) .add("a", "int", true) .add("b", "long", false) .add("c", "string", true)
Creates a new StructType by adding a new nullable field with no metadata where the dataType is specified as a String.
Creates a new StructType by adding a new nullable field with no metadata where the dataType is specified as a String.
val struct = (new StructType) .add("a", "int") .add("b", "long") .add("c", "string")
Creates a new StructType by adding a new field and specifying metadata.
Creates a new StructType by adding a new field and specifying metadata.
val struct = (new StructType) .add("a", IntegerType, true, Metadata.empty) .add("b", LongType, false, Metadata.empty) .add("c", StringType, true, Metadata.empty)
Creates a new StructType by adding a new field with no metadata.
Creates a new StructType by adding a new field with no metadata.
val struct = (new StructType) .add("a", IntegerType, true) .add("b", LongType, false) .add("c", StringType, true)
Creates a new StructType by adding a new nullable field with no metadata.
Creates a new StructType by adding a new nullable field with no metadata.
val struct = (new StructType) .add("a", IntegerType) .add("b", LongType) .add("c", StringType)
Creates a new StructType by adding a new field.
Creates a new StructType by adding a new field.
val struct = (new StructType) .add(StructField("a", IntegerType, true)) .add(StructField("b", LongType, false)) .add(StructField("c", StringType, true))
Returns a StructType containing StructFields of the given names, preserving the original order of fields.
Returns a StructType containing StructFields of the given names, preserving the original order of fields.
if a field cannot be found for any of the given names
Extracts the StructField with the given name.
Extracts the StructField with the given name.
if a field with the given name does not exist
String representation for the type saved in external catalogs.
String representation for the type saved in external catalogs.
The default size of a value of the StructType is the total default sizes of all field types.
The default size of a value of the StructType is the total default sizes of all field types.
Returns the index of a given field.
Returns the index of a given field.
if a field with the given name does not exist
Returns all field names in an array.
The compact JSON representation of this data type.
The compact JSON representation of this data type.
The pretty (i.
The pretty (i.e. indented) JSON representation of this data type.
(Changed in version 2.9.0) The behavior of scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
Readable string representation for the type.
Readable string representation for the type.
(Changed in version 2.9.0) transpose
throws an IllegalArgumentException
if collections are not uniformly sized.
Name of the type used in JSON serialization.
Name of the type used in JSON serialization.
(Since version 2.10.0) use fold instead
:: DeveloperApi :: A StructType object can be constructed by
StructType(fields: Seq[StructField])
For a StructType object, one or multiple StructFields can be extracted by names. If multiple StructFields are extracted, a StructType object will be returned. If a provided name does not have a matching field, it will be ignored. For the case of extracting a single StructField, a
null
will be returned. Example:A org.apache.spark.sql.Row object is used as a value of the StructType. Example: