I'm reading in csv-files with in one column a string that should be converted to a datetime. The string is in the form MM/dd/yyyy HH:mm
. However when I try to transform this using joda-time, I always get the error:
Exception in thread "main" java.lang.UnsupportedOperationException: Schema for type org.joda.time.DateTime is not supported
I don't know what exactly the problem is...
val input = c.textFile("C:\\Users\\AAPL.csv").map(_.split(",")).map{p =>
val formatter: DateTimeFormatter = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm");
val date: DateTime = formatter.parseDateTime(p(0));
StockData(date, p(1).toDouble, p(2).toDouble, p(3).toDouble, p(4).toDouble, p(5).toInt, p(6).toInt)
}.toDF()
Anybody who can help?