Class DataTypeUtils

java.lang.Object
smile.spark.DataTypeUtils

public final class DataTypeUtils extends Object
Bidirectional conversion utilities between Apache Spark SQL data types and SMILE data types.
  • Method Details

    • toSmileSchema

      public static StructType toSmileSchema(org.apache.spark.sql.types.StructType schema)
      Converts an Apache Spark schema to a SMILE schema.
      Parameters:
      schema - the Spark schema.
      Returns:
      the SMILE schema.
    • toSmileField

      public static StructField toSmileField(org.apache.spark.sql.types.StructField field)
      Converts an Apache Spark field to a SMILE field.
      Parameters:
      field - the Spark field.
      Returns:
      the SMILE field.
    • toSmileType

      public static DataType toSmileType(org.apache.spark.sql.types.DataType dtype, boolean nullable)
      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

      public static org.apache.spark.sql.types.StructType toSparkSchema(StructType schema)
      Converts a SMILE schema to an Apache Spark schema.
      Parameters:
      schema - the SMILE schema.
      Returns:
      the Spark schema.
    • toSparkField

      public static org.apache.spark.sql.types.StructField toSparkField(StructField field)
      Converts a SMILE field to an Apache Spark field.
      Parameters:
      field - the SMILE field.
      Returns:
      the Spark field.
    • toSparkType

      public static org.apache.spark.sql.types.DataType toSparkType(DataType dtype)
      Converts a SMILE data type to an Apache Spark SQL data type.
      Parameters:
      dtype - the SMILE data type.
      Returns:
      the Spark data type.