Zipper Table 2 in hive
This example takes hive as an example, which only considers implementation and has nothing to do with performance.
First create the table
12345678910111213141516171819202122232425CREATE TABLE orders (orderid INT,createtime STRING,modifiedtime STRING,status STRING) row format delimited fields terminated by'\ t 'CREATE TABLE ods_orders_inc (orderid INT,createtime STRING,modifiedtime STRING,status STRING) PARTITIONED BY (day STRING) row format delimited fields terminated by'\ t 'CREATE TABLE dw_orders_his (orderid INT,createtime STRING,modifiedtime STRING,status STRING,dw_start_date STRING,dw_end_date STRING) row format delimited fields terminated by'\ t'
First of all, a full update, we first to 2016-08-20 until the data.
Initialize, initialize the data of 2016-08-20 first.
1234INSERT overwrite TABLE ods_orders_inc PARTITION (day = '2016-08-20') SELECT orderid,createtime,modifiedtime,statusFROM ordersWHERE createtime