Class DataTypeUtils
java.lang.Object
smile.spark.DataTypeUtils
Bidirectional conversion utilities between Apache Spark SQL data types and SMILE data types.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StructFieldtoSmileField(org.apache.spark.sql.types.StructField field) Converts an Apache Spark field to a SMILE field.static StructTypetoSmileSchema(org.apache.spark.sql.types.StructType schema) Converts an Apache Spark schema to a SMILE schema.static DataTypetoSmileType(org.apache.spark.sql.types.DataType dtype, boolean nullable) Converts an Apache Spark SQL data type to a SMILE data type.static org.apache.spark.sql.types.StructFieldtoSparkField(StructField field) Converts a SMILE field to an Apache Spark field.static org.apache.spark.sql.types.StructTypetoSparkSchema(StructType schema) Converts a SMILE schema to an Apache Spark schema.static org.apache.spark.sql.types.DataTypetoSparkType(DataType dtype) Converts a SMILE data type to an Apache Spark SQL data type.
-
Method Details
-
toSmileSchema
Converts an Apache Spark schema to a SMILE schema.- Parameters:
schema- the Spark schema.- Returns:
- the SMILE schema.
-
toSmileField
Converts an Apache Spark field to a SMILE field.- Parameters:
field- the Spark field.- Returns:
- the SMILE field.
-
toSmileType
Converts an Apache Spark SQL data type to a SMILE data type.- Parameters:
dtype- the Spark data type.nullable- true if nullable.- Returns:
- the SMILE data type.
-
toSparkSchema
Converts a SMILE schema to an Apache Spark schema.- Parameters:
schema- the SMILE schema.- Returns:
- the Spark schema.
-
toSparkField
Converts a SMILE field to an Apache Spark field.- Parameters:
field- the SMILE field.- Returns:
- the Spark field.
-
toSparkType
Converts a SMILE data type to an Apache Spark SQL data type.- Parameters:
dtype- the SMILE data type.- Returns:
- the Spark data type.
-