Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abel_cjy
Amazon-Selection-Data
Commits
09b17719
Commit
09b17719
authored
Jul 30, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月销为Null归入0-50区间
parent
178e385f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
dwt_bs_top100.py
Pyspark_job/dwt/dwt_bs_top100.py
+7
-2
No files found.
Pyspark_job/dwt/dwt_bs_top100.py
View file @
09b17719
...
...
@@ -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
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment