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

import hiveContext.implicits._

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

我得到的错误是

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

我不确定为什么会这样 .

我在火花配置中使用了它

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

和我描述格式化productstorehtable2时的位置

hdfs://quickstart.cloudera:8020 / user / hive / warehouse / 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”))时,它只输出一个空行

谢谢