更新查询而不是插入覆盖查询

时间:2016-01-15 16:50:13

标签: hadoop hive hql

我在HIVE 1.2.1 version中插入了覆盖查询。我想在HIVE中使用Update而不是Insert overwrite。

有人可以建议或举例说明HIVE更新吗?下面是我使用的示例Insert Overwrite查询。

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);

0 个答案:

没有答案
相关问题