Serializable
, scala.collection.immutable.Iterable<StructField>
, scala.collection.immutable.Seq<StructField>
, scala.collection.immutable.SeqOps<StructField,scala.collection.immutable.Seq,scala.collection.immutable.Seq<StructField>>
, scala.collection.Iterable<StructField>
, scala.collection.IterableFactoryDefaults<StructField,scala.collection.Iterable>
, scala.collection.IterableOnce<StructField>
, scala.collection.IterableOnceOps<StructField,scala.collection.Iterable,scala.collection.Iterable>
, scala.collection.IterableOps<StructField,scala.collection.Iterable,scala.collection.Iterable>
, scala.collection.Seq<StructField>
, scala.collection.SeqOps<StructField,scala.collection.Seq,scala.collection.Seq<StructField>>
, scala.Equals
, scala.Function1<Object,StructField>
, scala.PartialFunction<Object,StructField>
, scala.Product
A
StructType
object can be constructed by
StructType(fields: Seq[StructField])
For a
StructType
object, one or multiple
StructField
s can be extracted by names. If multiple
StructField
s 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.
Scala Example:
import org.apache.spark.sql._
import org.apache.spark.sql.types._
val struct =
StructType(
StructField("a", IntegerType, true) ::
StructField("b", LongType, false) ::
StructField("c", BooleanType, false) :: Nil)
// Extract a single StructField.
val singleField = struct("b")
// singleField: StructField = StructField(b,LongType,false)
// If this struct does not have a field called "d", it throws an exception.
struct("d")
// java.lang.IllegalArgumentException: d does not exist.
// ...
// Extract multiple StructFields. Field names are provided in a set.
// A StructType object will be returned.
val twoFields = struct(Set("b", "c"))
// twoFields: StructType =
// StructType(StructField(b,LongType,false), StructField(c,BooleanType,false))
// Any names without matching fields will throw an exception.
// For the case shown below, an exception is thrown due to "d".
struct(Set("b", "c", "d"))
// java.lang.IllegalArgumentException: d does not exist.
// ...
A Row
object is used as a value of the StructType
.
Scala Example:
import org.apache.spark.sql._
import org.apache.spark.sql.types._
val innerStruct =
StructType(
StructField("f1", IntegerType, true) ::
StructField("f2", LongType, false) ::
StructField("f3", BooleanType, false) :: Nil)
val struct = StructType(
StructField("a", innerStruct, true) :: Nil)
// Create a Row with the schema defined by struct
val row = Row(Row(1, 2, true))
scala.Function1.UnliftOps<A extends Object,B extends Object>, scala.Function1.UnliftOps$
Nested classes/interfaces inherited from interface scala.collection.IterableOpsscala.collection.IterableOps.SizeCompareOps, scala.collection.IterableOps.SizeCompareOps$, scala.collection.IterableOps.WithFilter<A extends Object,CC extends Object>
Nested classes/interfaces inherited from interface scala.PartialFunctionscala.PartialFunction.ElementWiseExtractor<A extends Object,B extends Object>, scala.PartialFunction.ElementWiseExtractor$
Constructors
No-arg constructor for kryo.
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 field with no 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.
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 nullable field with no metadata.
Creates a new
StructType
by adding a new field with no metadata.
Creates a new
StructType
by adding a new field and specifying metadata.
Creates a new
StructType
by adding a new field and specifying metadata.
Returns a
StructType
containing
StructField
s of the given names, preserving the original order of fields.
String representation for the type saved in external catalogs.
int
The default size of a value of the StructType is the total default sizes of all field types.
boolean
int
Returns the index of a given field.
Returns all field names in an array.
Returns a StructType
that contains missing fields recursively from source
to target
.
Creates StructType for a given DDL-formatted string, which is a comma separated list of field definitions, e.g., a INT, b STRING.
int
int
Returns all field names in an array.
void
Readable string representation for the type.
Returns a string containing a schema in DDL format.
Returns the same data type but set all nullability fields are true (StructField.nullable
, ArrayType.containsNull
, and MapType.valueContainsNull
).
apply, apply$mcDD$sp, apply$mcDF$sp, apply$mcDI$sp, apply$mcDJ$sp, apply$mcFD$sp, apply$mcFF$sp, apply$mcFI$sp, apply$mcFJ$sp, apply$mcID$sp, apply$mcIF$sp, apply$mcII$sp, apply$mcIJ$sp, apply$mcJD$sp, apply$mcJF$sp, apply$mcJI$sp, apply$mcJJ$sp, apply$mcVD$sp, apply$mcVF$sp, apply$mcVI$sp, apply$mcVJ$sp, apply$mcZD$sp, apply$mcZF$sp, apply$mcZI$sp, apply$mcZJ$sp, compose
Methods inherited from interface scala.collection.IterableclassName, coll, collectionClassName, lazyZip, seq, toIterable
Methods inherited from interface scala.collection.IterableFactoryDefaultsempty, fromSpecific, newSpecificBuilder
Methods inherited from interface scala.collection.IterableOnceknownSize, stepper
Methods inherited from interface scala.collection.IterableOnceOps$colon$bslash, $div$colon, addString, addString, addString, aggregate, collectFirst, copyToArray, copyToArray, copyToArray, copyToBuffer, corresponds, count, exists, find, fold, foldLeft, foldRight, forall, foreach, hasDefiniteSize, max, maxBy, maxByOption, maxOption, min, minBy, minByOption, minOption, mkString, mkString, mkString, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, reversed, sum, to, toArray, toBuffer, toIndexedSeq, toIterator, toList, toMap, toSet, toStream, toVector
Methods inherited from interface scala.collection.IterableOps$plus$plus, collect, companion, drop, dropRight, dropWhile, filter, filterNot, flatMap, flatten, groupBy, grouped, groupMap, groupMapReduce, head, headOption, init, inits, isTraversableAgain, last, lastOption, map, partition, partitionMap, repr, scan, scanLeft, scanRight, sizeIs, slice, sliding, sliding, span, splitAt, tail, tails, take, takeRight, takeWhile, tapEach, toTraversable, transpose, unzip, unzip3, view, withFilter, zip, zipAll, zipWithIndex
Methods inherited from interface scala.PartialFunctionandThen, andThen, applyOrElse, compose, elementWise, isDefinedAt, lift, orElse, runWith, unapply
Methods inherited from interface scala.ProductproductArity, productElement, productElementName, productElementNames, productIterator, productPrefix
Methods inherited from interface scala.collection.immutable.SeqiterableFactory, toSeq
Methods inherited from interface scala.collection.SeqcanEqual, stringPrefix
Methods inherited from interface scala.collection.SeqOps$colon$plus, $colon$plus$plus, $plus$colon, $plus$plus$colon, appended, appendedAll, combinations, concat, contains, containsSlice, corresponds, diff, distinct, distinctBy, endsWith, findLast, indexOf, indexOf, indexOfSlice, indexOfSlice, indexWhere, indexWhere, indices, intersect, isDefinedAt, isEmpty, lastIndexOf, lastIndexOf$default$2, lastIndexOfSlice, lastIndexOfSlice, lastIndexWhere, lastIndexWhere, lengthCompare, lengthCompare, lengthIs, occCounts, padTo, patch, permutations, prefixLength, prepended, prependedAll, reverse, reverseIterator, reverseMap, sameElements, scala$collection$SeqOps$$toGenericSeq, search, search, segmentLength, segmentLength, size, sizeCompare, sizeCompare, sortBy, sorted, sortWith, startsWith, startsWith$default$2, union, updated, view
public StructType()
No-arg constructor for kryo.
ddl
- (undocumented)
Returns a StructType
that contains missing fields recursively from source
to target
. Note that this doesn't support looking into array type and map type recursively.
source
- (undocumented)
target
- (undocumented)
resolver
- (undocumented)
Returns all field names in an array.
Returns all field names in an array. This is an alias of
fieldNames
.
equals
in interface scala.Equals
equals
in interface scala.collection.Seq<StructField>
equals
in class Object
toString
in interface scala.Function1<Object,StructField>
toString
in interface scala.collection.Iterable<StructField>
toString
in interface scala.collection.Seq<StructField>
toString
in class Object
public int hashCode()
hashCode
in interface scala.collection.Seq<StructField>
hashCode
in class Object
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))
field
- (undocumented)
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)
name
- (undocumented)
dataType
- (undocumented)
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)
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
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)
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
metadata
- (undocumented)
Creates a new
StructType
by adding a new field and specifying metadata.
val struct = (new StructType)
.add("a", IntegerType, true, "comment1")
.add("b", LongType, false, "comment2")
.add("c", StringType, true, "comment3")
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
comment
- (undocumented)
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")
name
- (undocumented)
dataType
- (undocumented)
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)
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
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)
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
metadata
- (undocumented)
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, "comment1")
.add("b", "long", false, "comment2")
.add("c", "string", true, "comment3")
name
- (undocumented)
dataType
- (undocumented)
nullable
- (undocumented)
comment
- (undocumented)
name
- (undocumented)
IllegalArgumentException
- if a field with the given name does not exist
Returns a
StructType
containing
StructField
s of the given names, preserving the original order of fields.
names
- (undocumented)
IllegalArgumentException
- if at least one given field name does not exist
name
- (undocumented)
IllegalArgumentException
- if a field with the given name does not exist
public void printTreeString()
apply
in interface scala.collection.SeqOps<StructField,scala.collection.Seq,scala.collection.Seq<StructField>>
public int length()
length
in interface scala.collection.SeqOps<StructField,scala.collection.Seq,scala.collection.Seq<StructField>>
()
iterator
in interface scala.collection.IterableOnce<StructField>
public int defaultSize()
The default size of a value of the StructType is the total default sizes of all field types.
defaultSize
in class DataType
Readable string representation for the type.
simpleString
in class DataType
()
String representation for the type saved in external catalogs.
catalogString
in class DataType
Returns a string containing a schema in DDL format. For example, the following value:
StructType(Seq(StructField("eventId", IntegerType), StructField("s", StringType)))
will be converted to
eventId
INT,
s
STRING. The returned DDL schema can be used in a table creation.
Returns the same data type but set all nullability fields are true (
StructField.nullable
,
ArrayType.containsNull
, and
MapType.valueContainsNull
).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4