|
|
Richard 2012-03-16, 10:56
if I wang to update a table, e.g, insert overwrite table mytable select lower(col1), col2, col3 from mytable; if mytable has many columns but I only need to update one of them, how can I write the statement short?
-
Re: update a hive table
Bejoy Ks 2012-03-16, 12:26
Hey Richard First, don't treat hive as a database. Hive is just an interface above map reduce that help you write SQL like queries that inturn is converted to MR jobs. Saying that hive doesn't support update.
If you are just experimenting, the query that you wrote would overwrite a whole record (in a broader context a whole partion/table)
Regards Bejoy.K.S ________________________________ From: Richard <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Friday, March 16, 2012 4:26 PM Subject: update a hive table
if I wang to update a table, e.g, insert overwrite table mytable select lower(col1), col2, col3 from mytable; if mytable has many columns but I only need to update one of them, how can I write the statement short?
-
Re: update a hive table
Bejoy Ks 2012-03-16, 12:30
Hi Robert, Sorry I missed answering your question >If mytable has many columns but I only need to update one of them, how can I write the >statement short? It is not possible in hive. At a bare minimum hive would overwrite a partition (not even a record/file) if you frame an optimized query. Hope it helps!...
Regards Bejoy.K.S ________________________________ From: Bejoy Ks <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> Sent: Friday, March 16, 2012 5:56 PM Subject: Re: update a hive table
Hey Richard First, don't treat hive as a database. Hive is just an interface above map reduce that help you write SQL like queries that inturn is converted to MR jobs. Saying that hive doesn't support update.
If you are just experimenting, the query that you wrote would overwrite a whole record (in a broader context a whole partion/table)
Regards Bejoy.K.S ________________________________ From: Richard <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Friday, March 16, 2012 4:26 PM Subject: update a hive table
if I wang to update a table, e.g, insert overwrite table mytable select lower(col1), col2, col3 from mytable; if mytable has many columns but I only need to update one of them, how can I write the statement short?
-
Re: update a hive table
Appan Thirumaligai 2012-03-17, 23:32
create a new table and copy the data from your source table by doing lower(col1), drop the old table and rename the new table to old table.
On Fri, Mar 16, 2012 at 3:56 AM, Richard <[EMAIL PROTECTED]> wrote:
> if I wang to update a table, e.g, > > insert overwrite table mytable > select lower(col1), col2, col3 from mytable; > > if mytable has many columns but I only need to update one of them, how can > I write the > statement short? > > > >
-
Re:Re: update a hive table
Richard 2012-03-19, 02:30
I see, thanks. At 2012-03-16 20:30:24,"Bejoy Ks" <[EMAIL PROTECTED]> wrote:
Hi Robert, Sorry I missed answering your question >If mytable has many columns but I only need to update one of them, how can I write the >statement short? It is not possible in hive. At a bare minimum hive would overwrite a partition (not even a record/file) if you frame an optimized query.
Hope it helps!... Regards Bejoy.K.S From: Bejoy Ks <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> Sent: Friday, March 16, 2012 5:56 PM Subject: Re: update a hive table
Hey Richard First, don't treat hive as a database. Hive is just an interface above map reduce that help you write SQL like queries that inturn is converted to MR jobs. Saying that hive doesn't support update. If you are just experimenting, the query that you wrote would overwrite a whole record (in a broader context a whole partion/table) Regards Bejoy.K.S From: Richard <[EMAIL PROTECTED]> To:[EMAIL PROTECTED] Sent: Friday, March 16, 2012 4:26 PM Subject: update a hive table
if I wang to update a table, e.g, insert overwrite table mytable select lower(col1), col2, col3 from mytable; if mytable has many columns but I only need to update one of them, how can I write the statement short?
|
|