0

I have insert overwrite query in HIVE 1.2.1 version. I want to use Update instead of Insert overwrite in HIVE.

Can someone suggest or give an example in HIVE Update? Below is sample Insert Overwrite query I used.

Insert overwrite table temporary_table 
    select distinct
    stg.col1,
    stg.col2,
    stg.col3,
    case when tgt.cr_ts is Null then from_unixtime(unix_timestamp()) else             cast(tgt.cr_ts as string)  end as cr_ts ,
    case when ( stg.col1=tgt.col1    and 
            stg.col2=tgt.col2  and 
            stg.col3= tgt.col3 )        
      then cast(tgt.last_updt_ts as string) else cast         (from_unixtime(unix_timestamp()) as string )end as last_updt_ts
    from  stage_table stg
    left outer join target_table tgt
    On ( stg.col1= tgt.col1);
Community
  • 1
  • 1
Sai
  • 97
  • 1
  • 2
  • 17
  • Sai, You can try Partitioning the table and loading the latest records in the new partition. This So link will also help http://stackoverflow.com/questions/17810537/how-to-delete-and-update-a-record-in-hive – Abhi Jan 15 '16 at 18:06
  • Hi Abhi thank you for update..how about non-partitioned table.you have any example? – Sai Jan 17 '16 at 21:07

0 Answers0