Functionally map a Spark SQL data type to a native Scala types

Viewed 156

I am essentially looking for a way to get the mappings in the Spark SQL data type table programmatically.

Yes, I can always write a match expression like so:

val tag = schemaType match {
  case ByteType => ClassTag[Byte]
  case ShortType => ClassTag[Short]
  ...
}

But the API has to expose some method that does the same (and probably the reverse as well) without all the typing. I just can't seem to find it.

0 Answers
Related