Browse Source

fix(raw/trd): 拼团 dump 窗口改 2026-01-01 全量

5/18 窗漏刷 Jan~5/18 被更新过的老拼团(历史块是拉取时刻快照、未必最新);
改 COALESCE≥2026-01-01 全 2026、与订单表一致,重叠交 ODS 去重/OVERWRITE。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tianyu.chu 2 weeks ago
parent
commit
a0e78a631f

+ 2 - 2
manual/backfill/20260715_ods_trd_card_group_info_2026rebucket.sql

@@ -1,10 +1,10 @@
 -- 作者:tianyu.chu
 -- 作者:tianyu.chu
 -- 日期:2026-07-15
 -- 日期:2026-07-15
 -- 工单:(无)
 -- 工单:(无)
--- 目的:一次性重分桶——读中转表 raw.tmp_trd_card_group_info(dt=20260716) 全量 5/18 后拼团,
+-- 目的:一次性重分桶——读中转表 raw.tmp_trd_card_group_info(dt=20260716) 全量 2026 拼团,
 --       按 ods_dt = COALESCE(update_time,create_time) 的日动态分区写入 ods
 --       按 ods_dt = COALESCE(update_time,create_time) 的日动态分区写入 ods
 -- 状态:[待执行]
 -- 状态:[待执行]
--- 备注:动态分区 INSERT OVERWRITE 只覆盖 SELECT 出现的 ods_dt(5/18 后各日),不动更早历史分区;
+-- 备注:动态分区 INSERT OVERWRITE 只覆盖 SELECT 出现的 ods_dt(2026 各日),不动 2026 前历史分区;
 --       DISTRIBUTE BY dt(=投影后的 ods_dt)防每分区小文件(ADR-15);
 --       DISTRIBUTE BY dt(=投影后的 ods_dt)防每分区小文件(ADR-15);
 --       不做 (id,ods_dt) 去重——dump 是 PG 单次快照、一单一行、无同日重复,去重空操作。
 --       不做 (id,ods_dt) 去重——dump 是 PG 单次快照、一单一行、无同日重复,去重空操作。
 --       中间态按决策丢弃:每单只落当前最终态到其最后变更日分区。
 --       中间态按决策丢弃:每单只落当前最终态到其最后变更日分区。

+ 4 - 3
manual/backfill/20260715_tmp_trd_card_group_info_2026dump.ini

@@ -1,14 +1,15 @@
 ; 作者:tianyu.chu
 ; 作者:tianyu.chu
 ; 日期:2026-07-15
 ; 日期:2026-07-15
 ; 工单:(无)
 ; 工单:(无)
-; 目的:一次性拉拼团 5/18 后活跃记录(当前态)到中转表 raw.tmp_trd_card_group_info 单分区 dt=20260716
+; 目的:一次性拉拼团 2026 活跃记录(当前态)到中转表 raw.tmp_trd_card_group_info 单分区 dt=20260716
 ;       替代逐段补数 —— 一个 DataX job 灌完,交给 ODS 动态分区重分桶
 ;       替代逐段补数 —— 一个 DataX job 灌完,交给 ODS 动态分区重分桶
 ; 状态:[待执行]
 ; 状态:[待执行]
 ;
 ;
 ; 配套 DDL:manual/ddl/raw/trd/tmp_trd_card_group_info_create.sql
 ; 配套 DDL:manual/ddl/raw/trd/tmp_trd_card_group_info_create.sql
 ; 配套 ODS:manual/backfill/20260715_ods_trd_card_group_info_2026rebucket.sql
 ; 配套 ODS:manual/backfill/20260715_ods_trd_card_group_info_2026rebucket.sql
 ;
 ;
-; 窗口:拼团历史块(raw dt=20211027)覆盖 create≤5/18,本 dump 只刷 5/18 之后
+; 窗口:COALESCE≥2026-01-01 全 2026 活跃单(与订单表一致);与历史块(raw dt=20211027, create≤5/18)
+;       在 Jan~5/18 有重叠,ODS 按 (pk, ods_dt) 去重/OVERWRITE 兜住,保证 2026 各日均为当前态
 ; 运行(无 -backfill,单 job):
 ; 运行(无 -backfill,单 job):
 ;   python3 bin/datax-hive-import-starter.py \
 ;   python3 bin/datax-hive-import-starter.py \
 ;     -ini manual/backfill/20260715_tmp_trd_card_group_info_2026dump.ini \
 ;     -ini manual/backfill/20260715_tmp_trd_card_group_info_2026dump.ini \
@@ -22,7 +23,7 @@ database = hobby_stocks
 table = public.card_group_info
 table = public.card_group_info
 column = id,merchant_id,appid,name,code,status,specs,type,random_type,total_price,copies,unit_price,sold_copies,release_time,cycle,show_applet,title,msg,remark,create_time,update_by,update_time,order_quota_min,order_quota_max,user_quota_max,start_time,marketing_info,reviewmsg,lock,commission_rate,year,sport,manufacturer,sets,act,config,info_config,total_num,banner_end_time,add_banner,finished_time,display_name,group_sets_no,close_payment_time,confirm_send_time,close_payment_status,open_card,close_payment_record,group_full_time,live_create_time,live_start_time,live_end_time,report_start_time,report_end_time,report_review_num,report_review_first_time,report_review_end_time,review_hold_time,review_approval_time,review_num,config_json,free_flag,mer_name,change_type,act_price,act_config_json,real_sold_num,weight,hot_type,team_first,prop1,prop2,prop3,point_rate,point_max,point_min,list_id,list_code,mix_copies,sub_type,act_point_type,payment_method,payment_total_price,payment_commission,payment_finished_price,payment_remain_price,payment_online_price,exclusive,has_bg,merchant_sort,del_flg,del_time,review_account,act_id,sold_end_time,panini_list_id,hot_type_config,goods_type,report_flag,use_coupon,user_level,custom,gift_card_id,group_show_name,min_card_num,act_type,waring_type,compensation_status,point_type,first_act_config,gift_config,version,extra_prop,use_member_discount,merchant_open
 column = id,merchant_id,appid,name,code,status,specs,type,random_type,total_price,copies,unit_price,sold_copies,release_time,cycle,show_applet,title,msg,remark,create_time,update_by,update_time,order_quota_min,order_quota_max,user_quota_max,start_time,marketing_info,reviewmsg,lock,commission_rate,year,sport,manufacturer,sets,act,config,info_config,total_num,banner_end_time,add_banner,finished_time,display_name,group_sets_no,close_payment_time,confirm_send_time,close_payment_status,open_card,close_payment_record,group_full_time,live_create_time,live_start_time,live_end_time,report_start_time,report_end_time,report_review_num,report_review_first_time,report_review_end_time,review_hold_time,review_approval_time,review_num,config_json,free_flag,mer_name,change_type,act_price,act_config_json,real_sold_num,weight,hot_type,team_first,prop1,prop2,prop3,point_rate,point_max,point_min,list_id,list_code,mix_copies,sub_type,act_point_type,payment_method,payment_total_price,payment_commission,payment_finished_price,payment_remain_price,payment_online_price,exclusive,has_bg,merchant_sort,del_flg,del_time,review_account,act_id,sold_end_time,panini_list_id,hot_type_config,goods_type,report_flag,use_coupon,user_level,custom,gift_card_id,group_show_name,min_card_num,act_type,waring_type,compensation_status,point_type,first_act_config,gift_config,version,extra_prop,use_member_discount,merchant_open
 columnType =
 columnType =
-where = COALESCE(update_time, create_time) >= '2026-05-18'
+where = COALESCE(update_time, create_time) >= '2026-01-01'
 querySql =
 querySql =
 splitPk = id
 splitPk = id
 fetchSize = 1000
 fetchSize = 1000

+ 2 - 2
manual/ddl/raw/trd/tmp_trd_card_group_info_create.sql

@@ -1,9 +1,9 @@
 -- 作者:tianyu.chu
 -- 作者:tianyu.chu
 -- 日期:2026-07-15
 -- 日期:2026-07-15
 -- 工单:(无)
 -- 工单:(无)
--- 目的:一次性中转表——回填拼团 5/18 后数据的落地区,供 ODS 重分桶后即 DROP
+-- 目的:一次性中转表——回填拼团 2026 数据的落地区,供 ODS 重分桶后即 DROP
 -- 状态:[待执行]
 -- 状态:[待执行]
--- 生命周期:建表 → DataX 灌 dt=20260716(COALESCE≥2026-05-18 拼团 5/18 后活跃单当前态)
+-- 生命周期:建表 → DataX 灌 dt=20260716(COALESCE≥2026-01-01 拼团 2026 活跃单当前态)
 --           → ODS 读 WHERE dt='20260716' 动态分区重分桶 → DROP TABLE(内部表连数据一起清)
 --           → ODS 读 WHERE dt='20260716' 动态分区重分桶 → DROP TABLE(内部表连数据一起清)
 -- 备注:内部表(managed),DROP 自动清 HDFS;数据可从 PG 重抽,无兜底诉求。
 -- 备注:内部表(managed),DROP 自动清 HDFS;数据可从 PG 重抽,无兜底诉求。
 --       115 字段全 STRING,对齐 raw_trd_card_group_info_inc_d。
 --       115 字段全 STRING,对齐 raw_trd_card_group_info_inc_d。