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
87e52543
Commit
87e52543
authored
Oct 21, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asin详情解析兼容week维度
parent
b763f8f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
dim_asin_detail.py
Pyspark_job/dim/dim_asin_detail.py
+8
-3
No files found.
Pyspark_job/dim/dim_asin_detail.py
View file @
87e52543
...
@@ -40,6 +40,8 @@ class DimAsinDetail(object):
...
@@ -40,6 +40,8 @@ class DimAsinDetail(object):
self
.
site_name
=
site_name
self
.
site_name
=
site_name
self
.
date_type
=
date_type
self
.
date_type
=
date_type
self
.
date_info
=
date_info
self
.
date_info
=
date_info
# 周维度新版爬虫数据,解析逻辑与month一致
self
.
is_week_new_format
=
self
.
date_type
==
'week'
and
self
.
date_info
>=
'2026-01'
self
.
hive_tb
=
f
'dim_asin_detail'
self
.
hive_tb
=
f
'dim_asin_detail'
self
.
partition_dict
=
{
self
.
partition_dict
=
{
"site_name"
:
site_name
,
"site_name"
:
site_name
,
...
@@ -290,7 +292,8 @@ class DimAsinDetail(object):
...
@@ -290,7 +292,8 @@ class DimAsinDetail(object):
# 处理asin的变体信息
# 处理asin的变体信息
def
handle_asin_variation_attribute
(
self
):
def
handle_asin_variation_attribute
(
self
):
if
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-06'
:
if
(
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-06'
)
\
or
self
.
is_week_new_format
:
print
(
"执行新版的变体信息整合"
)
print
(
"执行新版的变体信息整合"
)
variat_schema
=
ArrayType
(
ArrayType
(
StringType
()))
variat_schema
=
ArrayType
(
ArrayType
(
StringType
()))
self
.
df_asin_detail
=
self
.
df_asin_detail
.
withColumn
(
"variat_list_change"
,
F
.
from_json
(
F
.
col
(
"variat_list"
),
variat_schema
))
self
.
df_asin_detail
=
self
.
df_asin_detail
.
withColumn
(
"variat_list_change"
,
F
.
from_json
(
F
.
col
(
"variat_list"
),
variat_schema
))
...
@@ -332,7 +335,8 @@ class DimAsinDetail(object):
...
@@ -332,7 +335,8 @@ class DimAsinDetail(object):
# 处理asin的配送方式信息
# 处理asin的配送方式信息
def
handle_asin_buy_box_seller_type
(
self
):
def
handle_asin_buy_box_seller_type
(
self
):
if
(
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-05'
)
\
if
(
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-05'
)
\
or
(
self
.
date_type
==
'4_week'
and
self
.
date_info
>=
'2024-21'
):
or
(
self
.
date_type
==
'4_week'
and
self
.
date_info
>=
'2024-21'
)
\
or
self
.
is_week_new_format
:
self
.
df_asin_detail
=
self
.
df_asin_detail
.
withColumn
(
self
.
df_asin_detail
=
self
.
df_asin_detail
.
withColumn
(
'seller_json'
,
'seller_json'
,
F
.
when
(
F
.
when
(
...
@@ -482,7 +486,8 @@ class DimAsinDetail(object):
...
@@ -482,7 +486,8 @@ class DimAsinDetail(object):
# 处理asin小图信息
# 处理asin小图信息
def
handle_asin_img_info
(
self
):
def
handle_asin_img_info
(
self
):
if
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-06'
:
if
(
self
.
date_type
in
[
'month'
,
'month_week'
,
'month_aba_me'
]
and
self
.
date_info
>=
'2024-06'
)
\
or
self
.
is_week_new_format
:
img_schema
=
ArrayType
(
ArrayType
(
StringType
()))
img_schema
=
ArrayType
(
ArrayType
(
StringType
()))
df_asin_with_img
=
self
.
df_asin_detail
.
withColumn
(
"img_list"
,
F
.
from_json
(
F
.
col
(
"img_list"
),
img_schema
))
.
filter
(
F
.
size
(
"img_list"
)
>
0
)
.
\
df_asin_with_img
=
self
.
df_asin_detail
.
withColumn
(
"img_list"
,
F
.
from_json
(
F
.
col
(
"img_list"
),
img_schema
))
.
filter
(
F
.
size
(
"img_list"
)
>
0
)
.
\
select
(
"asin"
,
F
.
explode
(
"img_list"
)
.
alias
(
"img_attributes"
))
.
\
select
(
"asin"
,
F
.
explode
(
"img_list"
)
.
alias
(
"img_attributes"
))
.
\
...
...
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