hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clay McDonald <>
Subject RE: simple insert query question
Date Thu, 19 Jun 2014 14:09:39 GMT
Got it. Thanks!

From: Nitin Pawar []
Sent: Thursday, June 19, 2014 10:08 AM
Cc: Nishant Kelkar
Subject: Re: simple insert query question

remember in hive, insert operation is

1) from a file
2) from another table

hive's underlying storage is hdfs which is not meant for having just single record kind of
stuff (as of now, this will change once hive starts supporting ACID actions in coming releases)

1) either create a sample file and load data in table using file
2) or create a dummy table and then write insert into table select from table2 kind of dummy

On Thu, Jun 19, 2014 at 7:26 PM, Clay McDonald <<>>
What about if I wanted to run this in hive,

create table test_log (test_time timestamp, test_notes varchar(60));

insert into table test_log values(now(),'THIS IS A TEST');

From: Nishant Kelkar [<>]
Sent: Thursday, June 19, 2014 9:29 AM
To:<>; Clay McDonald
Subject: Re: simple insert query question

Hey Stuart,

As far as I know, files in HDFS are immutable. So I would think that your query below would
not have a direct Hive conversion.

What you can do though, is create a local text file and then create an EXTERNAL TABLE on top
of that. Then, instead of your INSERT query, just use some linux command to append a line
to text file. It will automatically reflect in your external Hive table! :)

To understand what Hive external tables are and how to create them, I'd just go on the Hive
wiki page.

Good luck!

On Jun 19, 2014 6:17 AM, "Clay McDonald" <<>>
 hi all,

how do I write the following query to insert a note with a current system timestamp?

I tried the following;


thanks, Clay

Nitin Pawar
View raw message