【spark】spark-hive操作

来源:互联网 发布:国产胖熊熊片数据库 编辑:程序博客网 时间:2024/05/18 00:58
hiveserver2
hive on tez 
1,创建maven项目,就hive-site.xml,core-size.xml,hdfs-site.xml
放到项目resources下面


2.spark-hive连接:
package com.people.item/** * Created by Administrator on 2017/8/29. */import org.apache.spark.sql.hive.HiveContextimport org.apache.spark.{SparkConf, SparkContext}object SparkHiveText {  def main(args: Array[String]) {    val conf=new SparkConf().setMaster("local[2]").setAppName("SparkHiveText")    val sc=new SparkContext(conf)    val hc=new HiveContext(sc)    import hc.implicits._    hc.sql("select * from data.article limit 1").show()    sc.stop()  }}


原创粉丝点击