Commit 09b17719 by hejiangming

月销为Null归入0-50区间

parent 178e385f
......@@ -486,7 +486,8 @@ class DwtBsTop100(Templates):
# 段内 = 该 asin 利润率、段外 = null;下游 handle_bs_level 对每列 F.avg = 该分类该段的平均利润率。
# 沿用上游 dwt_flow_asin.asin_price_type 的左闭右开 >=下界 AND <上界。
# 价格:>0 排除 0/null(价格 0 是脏数据);10→10-20、80→"80及以上"(>=80)。
# 月销:字段 asin_amazon_orders(前台月销)实测为干净正整数、无 0,null(前台无徽章)条件不成立自动排除。
# 月销:字段 asin_amazon_orders(前台月销)实测为干净正整数、无 0;null=前台无徽章,归入 0-50 段
# (业务确认:徽章最低档就是 50+,无徽章即月销未达 50;不归的话 0-50 段实测全空)。
# 【显式 cast("double")】asin_amazon_orders 是 string 类型(前台月销原始文本),Hive CAST 曾抽风,
# Spark 里显式转 double 再比大小更稳;asin_price 同样转一下统一。
# 【列名】与 整体均值列同源前缀 asin_{ocean|air}_freight_gross_margin + 段后缀;
......@@ -503,7 +504,11 @@ class DwtBsTop100(Templates):
("price_50_80", (price_col >= 50) & (price_col < 80)),
("price_80", (price_col >= 80)),
# 月销区间(后缀 orders_*)
("orders_0_50", (orders_col >= 0) & (orders_col < 50)),
# 旧:null 不满足条件被自动排除 → 0-50 段全空(徽章最低 50+,没有月销<50 的 asin)
# ("orders_0_50", (orders_col >= 0) & (orders_col < 50)),
# 新:null 一并归入 0-50 段,与 asin_orders_ge_50_rate 把 null 算作"不达标"的口径一致。
# 用 cast 后的 orders_col 判 null:脏文本 cast 失败也会落这段(实测无脏值)。
("orders_0_50", orders_col.isNull() | ((orders_col >= 0) & (orders_col < 50))),
("orders_50_100", (orders_col >= 50) & (orders_col < 100)),
("orders_100_200", (orders_col >= 100) & (orders_col < 200)),
("orders_200_500", (orders_col >= 200) & (orders_col < 500)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment