8

I hope there is an obvious answer to this question!

I've just upgraded to Spark v2.0 and have an odd problem with the spark-shell (Scala 2.11 build).

If I enter the following minimal Scala,

import java.sql.Timestamp

case class Crime(caseNumber: String, date: Timestamp, description: String, detail: String, arrest: Boolean)

I get the following error,

<console>:11: error: not found: type Timestamp

If I use the Java Timestamp class elsewhere, e.g. in a function, then no errors are generated (as you would expect because of the import).

If I fully qualify and use java.sql.Timestamp in the case class it works!

Am I missing something obvious?

combinatorist
  • 562
  • 1
  • 4
  • 17
Max van Daalen
  • 317
  • 2
  • 14

1 Answers1

12

It's just that the Timestamp is not loaded in the case class declaration, to fix this you can:

:paste
import java.sql.Timestamp
case class Crime(caseNumber: String, date: Timestamp, description: String, detail: String, arrest: Boolean)

or

case class Crime(caseNumber: String, date: java.sql.Timestamp, description: String, detail: String, arrest: Boolean)
Mikel San Vicente
  • 3,831
  • 2
  • 21
  • 39