Package org.apache.spark.sql.types
Class StructField
Object
org.apache.spark.sql.types.StructField
- All Implemented Interfaces:
Serializable,scala.Equals,scala.Product,scala.Serializable
A field inside a StructType.
param: name The name of this field.
param: dataType The data type of this field.
param: nullable Indicates if values of this field can be
null values.
param: metadata The metadata of this field. The metadata should be preserved during
transformation if the content of the column is not modified, e.g, in selection.
- Since:
- 1.3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStructField(String name, DataType dataType, boolean nullable, Metadata metadata) -
Method Summary
Modifier and TypeMethodDescriptionabstract static Rapply(T1 v1, T2 v2, T3 v3, T4 v4) Clears the StructField of its current default value, if any.dataType()scala.Option<String>Return the comment of this StructField.scala.Option<String>Return the current default value of this StructField.metadata()name()booleannullable()toDDL()Returns a string containing a schema in DDL format.toString()withComment(String comment) Updates the StructField with a new comment value.withCurrentDefaultValue(String value) Updates the StructField with a new current default value.withExistenceDefaultValue(String value) Updates the StructField with a new existence default value.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface scala.Equals
canEqual, equalsMethods inherited from interface scala.Product
productArity, productElement, productIterator, productPrefix
-
Constructor Details
-
StructField
-
-
Method Details
-
apply
public abstract static R apply(T1 v1, T2 v2, T3 v3, T4 v4) -
name
-
dataType
-
nullable
public boolean nullable() -
metadata
-
toString
-
withComment
Updates the StructField with a new comment value.- Parameters:
comment- (undocumented)- Returns:
- (undocumented)
-
getComment
Return the comment of this StructField.- Returns:
- (undocumented)
-
withCurrentDefaultValue
Updates the StructField with a new current default value.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
clearCurrentDefaultValue
Clears the StructField of its current default value, if any.- Returns:
- (undocumented)
-
getCurrentDefaultValue
Return the current default value of this StructField.- Returns:
- (undocumented)
-
withExistenceDefaultValue
Updates the StructField with a new existence default value.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
toDDL
Returns a string containing a schema in DDL format. For example, the following value:StructField("eventId", IntegerType, false)will be converted toeventIdINT NOT NULL.StructField("eventId", IntegerType, true)will be converted toeventIdINT.- Returns:
- (undocumented)
- Since:
- 2.4.0
-