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
ConstructorDescriptionStructField
(String name, DataType dataType, boolean nullable, Metadata metadata) -
Method Summary
Modifier and TypeMethodDescriptionabstract static R
apply
(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()
boolean
nullable()
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, wait
Methods inherited from interface scala.Equals
canEqual, equals
Methods 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 toeventId
INT NOT NULL.StructField("eventId", IntegerType, true)
will be converted toeventId
INT.- Returns:
- (undocumented)
- Since:
- 2.4.0
-