spark连接hive找不到table

Caused by: org.apache.spark.sql.catalyst.analysis.NoSuchTableException: Table or view 'xxxx' not found....

 

hive-site.xml需要配置 hive.metastore.uris  并启动9083 thrift接口。

<property>
    <name>hive.metastore.uris</name>
    <value>thrift://127.0.0.1:9083</value>
    <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
  </property>

  

启动hive的metastroe:

hive --service metastore

  

 附sparsql代码:

def main(args: Array[String]): Unit = {

    val spark: SparkSession = new SparkSession
      .Builder()
      .master("local")
//      master("spark://bogon:7077")
      .appName("kafka test")
      .config("spark.sql.warehouse.dir", "/user/hive/warehouse")
      .enableHiveSupport()
      .getOrCreate()

}

  

posted @ 2019-10-16 17:37  Jenkin.K  阅读(1542)  评论(0编辑  收藏  举报