The error "Invalid job type for this context" in spark SQL job with Spark job server

954 Views Asked by At

I create a spark SQL job with spark job server and use HiveContext following the sample below: https://github.com/spark-jobserver/spark-jobserver/blob/master/job-server-extras/src/spark.jobserver/HiveTestJob.scala

I was able to start the server but when I run my application(my Scala class which extends SparkSqlJob), I am getting the following as response:

{
   "status": "ERROR",

   "result": "Invalid job type for this context"
 }

Can any one suggest me what is going wrong or provide a detailed procedure for setting up jobserver for SparkSQL?

The code is below:

import com.typesafe.config.{Config, ConfigFactory}
import org.apache.spark._
import org.apache.spark.sql.hive.HiveContext
import spark.jobserver.{SparkJobValid, SparkJobValidation, SparkHiveJob}

object newHiveRest extends SparkHiveJob {


  def validate(hive: HiveContext, config: Config): SparkJobValidation = SparkJobValid

  def runJob(hive: HiveContext, config: Config): Any = {

    hive.sql(s"use default")
    val maxRdd = hive.sql(s"select count(*) from 'default'.'passenger'")

    maxRdd.count()
  }
}
1

There are 1 best solutions below

3
On