找不到表或视图 - 将hive表转换为spark数据帧

时间:2016-12-26 20:19:01

标签: hadoop apache-spark hive sbt apache-spark-sql

我正在尝试执行以下操作:

import hiveContext.implicits._

val productDF=hivecontext.sql("select * from productstorehtable2")
println(productDF.show())

我得到的错误是

  

org.apache.spark.sql.AnalysisException:找不到表或视图:   productstorehtable2;第1行第14页

我不确定为什么会这样。

我在火花配置中使用了这个

set(“spark.sql.warehouse.dir”,“hdfs://quickstart.cloudera:8020 / user / hive / warehouse”)

和我描述格式化productstorehtable2的位置

  

HDFS://quickstart.cloudera:8020 /用户/蜂巢/仓库/ productstorehtable2

我已使用此代码创建表

create external table if not exists productstorehtable2
(
device  string,
date  string,
word  string,
count  int
)
row format delimited fields terminated by ','
location 'hdfs://quickstart.cloudera:8020/user/cloudera/hadoop/hive/warehouse/VerizonProduct2'; 

我使用sbt(带有spark依赖项)来运行应用程序。我的操作系统是CentOS,我有火花2.0

有人可以帮我找出我错的地方吗?

编辑:

当我执行println(hivecontext.sql(“show tables”))时它只输出一个空行

由于

0 个答案:

没有答案