Using a Cygwin distribution, I've installed Hadoop 0.20.3 and Hive 0.11.0.
First of all, I don't understand how to use the Hive CLI:
hive> show tables;
Then enter and nothing happens. I can execute queries using hive -e/-f.
Then, I've created a table:
CREATE TABLE tweet_table(
tweet STRING
)
COMMENT 'Table of string'
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")
I've got an error:
FAILED: ParseException line 1:30 cannot recognize input near '(' 'tweet' ')' in select clause
How can I append data in my table?
INSERT ... VALUES, UPDATE, DELETE, and MERGE SQL statements are supported in Apache Hive 0.14 and later. The INSERT ... VALUES statement enable users to write data to Apache Hive from values provided in SQL statements. The UPDATE and DELETE statements enable users to modify and delete values already written to Hive.
You can insert new data into table by two ways.
Load the data of a file into table using load command.
LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename.
You can insert new data into table by using select query.
INSERT INTO table tablename1 select columnlist FROM secondtable;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With