简体   繁体   English

如何将临时表保存到Hive Metastore(并在Hive中进行分析)?

[英]How to save temptable to Hive metastore (and analyze it in Hive)?

I use Spark 1.3.1. 我使用Spark 1.3.1。

How to store/save a DataFrame data to a Hive metastore? 如何将DataFrame数据存储/保存到Hive Metastore?

In Hive If I run show tables the DataFrame does not appear as a table in Hive databases. 在Hive中如果运行show tables则DataFrame不会在Hive数据库中显示为表。 I have copied hive-site.xml to $SPARK_HOME/conf , but it didn't help (and the dataframe does not appear in Hive metastore either). 我已经将hive-site.xml复制到$SPARK_HOME/conf ,但是它没有帮助(数据框也不会出现在Hive Metastore中)。

I am following this document , using spark 1.4 version. 我正在使用spark 1.4版本关注此文档

dataframe.registerTempTable("people")

How to analyze the spark table in Hive? 如何在Hive中分析火花表?

You can use insertInto method to save dataframe in hive. 您可以使用insertInto方法将数据帧保存在配置单元中。

Example: 例:

dataframe.insertInto("table_name", false);
//2nd arg is to specify if table should be overridden

Got the solution. 得到了解决方案。 I am using spark 1.3.1, so that it's not supporting all. 我正在使用spark 1.3.1,因此它不支持所有功能。 Now using spark 1.5.1 that problem resolved. 现在使用spark 1.5.1解决了这个问题。 I have noticed data-frames fully working after 1.40. 我注意到数据帧在1.40之后可以正常工作。 Many commands are deprecated. 不建议使用许多命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM