All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spark.jobserver.context.HiveContextFactory.scala Maven / Gradle / Ivy

The newest version!
package spark.jobserver.context

import com.typesafe.config.Config
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.sql.hive.HiveContext
import spark.jobserver.{ContextLike, SparkHiveJob, SparkJobBase}
import spark.jobserver.util.SparkJobUtils

class HiveContextFactory extends SparkContextFactory {
  type C = HiveContext with ContextLike

  def makeContext(sparkConf: SparkConf, config: Config,  contextName: String): C = {
    contextFactory(sparkConf)
  }

  protected def contextFactory(conf: SparkConf): C = {
    new HiveContext(new SparkContext(conf)) with HiveContextLike
  }
}

private[jobserver] trait HiveContextLike extends ContextLike {
  def isValidJob(job: SparkJobBase): Boolean = job.isInstanceOf[SparkHiveJob]
  def stop() { this.sparkContext.stop() }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy