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
a7df831d
Commit
a7df831d
authored
Jul 21, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
品类调研改为node_id分类
parent
17c74913
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
dwt_bs_top100.py
Pyspark_job/dwt/dwt_bs_top100.py
+0
-0
dwt_bs_top100_change_rate.py
Pyspark_job/dwt/dwt_bs_top100_change_rate.py
+4
-4
dwt_bs_top100.py
Pyspark_job/sqoop_export/dwt_bs_top100.py
+2
-2
dwt_bs_top100_change_rate.py
Pyspark_job/sqoop_export/dwt_bs_top100_change_rate.py
+1
-1
No files found.
Pyspark_job/dwt/dwt_bs_top100.py
View file @
a7df831d
This diff is collapsed.
Click to expand it.
Pyspark_job/dwt/dwt_bs_top100_change_rate.py
View file @
a7df831d
...
...
@@ -52,7 +52,7 @@ class DwtBsTop100ChangeRate(object):
# 跨月对齐主键:分类多归属(同 current_id 挂多个父级路径=多行),只用 current_id 会 1:N 串行。
# current_id + parent_id_join(根→直接父级的完整路径)= 每行唯一(已实测 2026-05 分区无重复)。
JOIN_KEYS
=
[
'asin_
bs_cate_current_id'
,
'asin_bs_cat
e_parent_id_join'
]
JOIN_KEYS
=
[
'asin_
node_current_id'
,
'asin_nod
e_parent_id_join'
]
def
__init__
(
self
,
site_name
,
date_type
,
date_info
):
self
.
site_name
=
site_name
...
...
@@ -101,10 +101,10 @@ class DwtBsTop100ChangeRate(object):
return
df
def
read_data
(
self
):
# 本期额外带 level
(落表用,便于后端/排查
),对比期只要指标值
# 本期额外带 level
+ leaf_node(落表用,便于后端/前端按叶子筛
),对比期只要指标值
metric_cols
=
[
m
for
m
,
_
in
self
.
METRICS
]
base_sql
=
f
"""
select {', '.join(self.JOIN_KEYS + ['level'] + metric_cols)}
select {', '.join(self.JOIN_KEYS + ['level'
, 'leaf_node'
] + metric_cols)}
from {self.source_tb}
where site_name='{self.site_name}' and date_type='{self.date_type}' and date_info='{self.date_info}'
"""
...
...
@@ -181,7 +181,7 @@ class DwtBsTop100ChangeRate(object):
for
m
,
_
in
self
.
METRICS
:
rate_cols
.
append
(
f
"{m}_ym_rate"
)
rate_cols
.
append
(
f
"{m}_lm_rate"
)
out_cols
=
self
.
JOIN_KEYS
+
[
'level'
]
+
rate_cols
out_cols
=
self
.
JOIN_KEYS
+
[
'level'
,
'leaf_node'
]
+
rate_cols
self
.
df_save
=
self
.
df_save
.
select
(
*
out_cols
)
\
.
withColumn
(
"site_name"
,
F
.
lit
(
self
.
site_name
))
\
...
...
Pyspark_job/sqoop_export/dwt_bs_top100.py
View file @
a7df831d
...
...
@@ -78,8 +78,8 @@ if __name__ == '__main__':
# 导出列 = 86 业务列 + 3 分区列(列名与 Hive dwt_bs_top100 一致, sqoop 按名映射 PG 同名列)
export_cols
=
[
# 维度 / 键
"asin_
bs_cate_current_id"
,
"asin_bs_cate_parent_id"
,
"asin_bs_cat
e_parent_id_join"
,
"level"
,
"cur_category_name"
,
"asin_
node_current_id"
,
"asin_node_parent_id"
,
"asin_nod
e_parent_id_join"
,
"level"
,
"cur_category_name"
,
"leaf_node"
,
# 销量类
"asin_amazon_orders_sum"
,
"asin_bsr_orders_sum"
,
"asin_bsr_orders_sum_new"
,
"asin_bsr_orders_sum_brand"
,
"asin_bsr_orders_mean"
,
"asin_bsr_orders_mean_new"
,
"asin_bsr_orders_mean_brand"
,
"asin_bsr_orders_sum_parent"
,
...
...
Pyspark_job/sqoop_export/dwt_bs_top100_change_rate.py
View file @
a7df831d
...
...
@@ -78,7 +78,7 @@ if __name__ == '__main__':
# 导出列 = join键2 + level + 28 变化率列 + 3 分区列(列名与 Hive dwt_bs_top100_change_rate 一致)
export_cols
=
[
"asin_
bs_cate_current_id"
,
"asin_bs_cate_parent_id_join"
,
"level
"
,
"asin_
node_current_id"
,
"asin_node_parent_id_join"
,
"level"
,
"leaf_node
"
,
"asin_amazon_orders_sum_ym_rate"
,
"asin_amazon_orders_sum_lm_rate"
,
"asin_bsr_orders_sum_ym_rate"
,
"asin_bsr_orders_sum_lm_rate"
,
"asin_bsr_orders_mean_ym_rate"
,
"asin_bsr_orders_mean_lm_rate"
,
...
...
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