Due to an over-complicated process, I need to convert strings representing a data type to an actual org.apache.spark.sql.types data type. I've got a simple function almost working.
def getType (s: String): DataType = {
s match {
case "string" => StringType
...
case "decimal" => DecimalType
//case "decimal" => org.apache.spark.sql.types.DecimalType
}
}
Both versions of the decimal line cause it to fail:
found : org.apache.spark.sql.types.DecimalType.type
required: org.apache.spark.sql.types.DataType
How do I handle this?