Hive Tables are created from spark but are not visible in hive

落爺英雄遲暮 提交于 2019-12-08 07:04:56

问题


From spark using:

DataFrame.write().mode(SaveMode.Ignore).format("orc").saveAsTable("myTableName")

Table is getting saved I can see using below command's hadoop fs -ls /apps/hive/warehouse\test.db' where test is my database name

drwxr-xr-x - psudhir hdfs 0 2016-01-04 05:02 /apps/hive/warehouse/test.db/myTableName

but when I trying to check tables in Hive I cannot view them either with command SHOW TABLES from hiveContext.


回答1:


sudo cp /etc/hive/conf.dist/hive-site.xml /etc/spark/conf/

This worked for me in a Cloudera quick start Virtual Box.




回答2:


You have to copy the hive-site.xml file (mine is located at /etc/hive/conf.dist/hive-site.xml) to Spark conf folder (mine is located at /etc/spark/conf/)

sudo cp /etc/hive/conf.dist/hive-site.xml /etc/spark/conf/

Restart Spark and it should work.




回答3:


I think you need to run INVALIDATE METADATA; in the hive console to refresh the databases and view your new table.



来源:https://stackoverflow.com/questions/34591704/hive-tables-are-created-from-spark-but-are-not-visible-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!