Reputation: 7
I have file in with an SQL query, which I need to run using SparkSQL. Since the file is too big, I don't want to copy it straight into the code.
.
├──_main.scala
├──_resources
│ └── query.sql
Howewer when I compile it
scalac -cp "<path-to-resources>/*:<jars path>/*" -d "main.jar" main.scala
and try to run, it throws NullPointerException when I try to call "mkString"
val queryIt = scala.io.Source.fromInputStream(getClass.getClassLoader.getResourceAsStream("query.sql"))
val query = try queryIt.mkString finally queryIt.close()
Upvotes: 0
Views: 22