核心接口

trait SparkOnEsService {
  val conf = new SparkConf
//  conf.setMaster("local[10]")
  val file = new File("lib").getCanonicalFile.listFiles()
  val fs = file.toSeq.map(f => {
    f.getAbsolutePath
  })
  conf.setJars(fs)
  conf.setAppName("spark_sql_on_es")
  val sqlContext = SparkSession.builder().config(conf).getOrCreate()
  val options = Map("pushdown" -> "true", "es.nodes" -> "ip", "es.port" -> "prot")
  valt1 = sqlContext.read.format("org.elasticsearch.spark.sql").options(options).load("index/index_type")
  val t2 = sqlContext.read.format("org.elasticsearch.spark.sql").options(options).load("index/index_type")
  t1.createTempView("v1")
  t2.createTempView("v2")
  def excutor(sql: String): DataResult
}

 

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2021-08-14
  • 2021-07-05
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-11-07
  • 2021-12-31
  • 2022-12-23
  • 2021-07-15
相关资源
相似解决方案