1

What do I add to my SBT and include in my Scala class header to build a SnappyJob to use via snappy-job.sh submit?

I'm attempting to do some basic "Hello World" work in the form of a SnappyData job, before experimenting with building a job combined with other libraries based on Spark.

I'm stuck at the very beginning, attempting to build the shell of a program as described here:

https://snappydatainc.github.io/snappydata/programming_guide/snappydata_jobs/

I've input the following:

class snappytest implements SnappySQLJob {
  /** SnappyData uses this as an entry point to execute SnappyData jobs. **/
  def runSnappyJob(snappy: SnappySession, jobConfig: Config): Any = {}

  /** SnappyData calls this function to validate the job input and reject invalid job requests **/
  def isValidJob(snappy: SnappySession, config: Config): SnappyJobValidation = {}
}

Further down the page, it says "For writing jobs, users need to include snappydata-cluster_2.11:1.0.0 to their project dependencies." My SBT has:

name := "snappytest"

version := "0.1"

scalaVersion := "2.11.11"

libraryDependencies += "io.snappydata" % "snappy-spark-core_2.11" % "2.1.1.1"
libraryDependencies += "io.snappydata" % "snappy-spark-sql_2.11" % "2.1.1.1"
libraryDependencies += "io.snappydata" % "snappydata-cluster_2.11" % "1.0.0"

The header of my class file has:

import org.apache.spark.sql._
import org.apache.spark.sql.SnappySQLJob

IntelliJ IDEA is giving me the following errors in the IDE.

  1. Immediately after "snappytest", "'; ' or newline expected."
  2. Next word, "Cannot resolve symbol implements."
  3. Next word, "Cannot resolve symbol SnappySQLJob."
  4. In both def statements, "Cannot resolve symbol Config."
  5. If I Alt-Enter Config, I see many suggestions for what class to import, but none of them are Snappy or Spark-related.
Joseph Pride
  • 165
  • 11
  • Just looking at one of the [examples](https://github.com/SnappyDataInc/snappydata/tree/master/examples/src/main/scala/io/snappydata/examples) from the link provided on that doc it appears you may be missing `import org.apache.spark.sql.snappy._` see [here](https://github.com/SnappyDataInc/snappydata/blob/master/examples/src/main/scala/io/snappydata/examples/AirlineDataJob.scala) – plamb Nov 21 '17 at 21:12
  • 1
    The document seems incorrect. Please refer https://github.com/SnappyDataInc/snappydata/blob/master/examples/src/main/scala/org/apache/spark/examples/snappydata/CreateColumnTable.scala for an example scala job. Thanks for pointing it out. – Rishitesh Mishra Nov 22 '17 at 05:23
  • Rishitesh: That example steered me true so far! Fixes found in that example doc so far: "snappytest extends SnappySQLJob" instead of "snappytest implements SnappySQLJob" , and "import com.typesafe.config.Config" . I think as a rookie I might be able to push through from here. – Joseph Pride Nov 27 '17 at 06:54

0 Answers0