将数据插入到hive表中 [英] Insert data into hive table
本文介绍了将数据插入到hive表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Cygwin发行版,我安装了Hadoop 0.20.3和Hive 0.11.0。
Using a Cygwin distribution, I've installed Hadoop 0.20.3 and Hive 0.11.0.
首先,我不明白如何使用Hive CLI:
First of all, I don't understand how to use the Hive CLI:
hive> show tables;
然后输入,什么也不发生。我可以使用 hive -e / -f。
Then enter and nothing happens. I can execute queries using hive -e/-f.
然后,我创建了一个表: / p>
Then, I've created a table:
CREATE TABLE tweet_table(
tweet STRING
)
COMMENT 'Table of string'
但是如何在此表中插入数据?我看到一些 INSERT INTO
示例,但是当我尝试:
But how can I insert data into this table? I see some INSERT INTO
examples but when I try:
INSERT INTO TABLE tweet_table (tweet) VALUES ("data")
我有一个错误:
FAILED: ParseException line 1:30 cannot recognize input near '(' 'tweet' ')' in select clause
如何在我的表中附加数据?
How can I append data in my table?
推荐答案
您可以通过两种方式将新数据插入表格。
You can insert new data into table by two ways.
-
将文件的数据加载到表格,使用载入命令。
LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename.
您可以使用选择查询。
INSERT INTO table tablename1 select columnlist FROM secondtable;
这篇关于将数据插入到hive表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文