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
91bd0f0a
Commit
91bd0f0a
authored
Aug 07, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流量选品30天模块-兼容landing_asin字段判断asin跳转
parent
9cba6f71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
kafka_flow_asin_detail_to_doris.py
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
+9
-7
No files found.
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
View file @
91bd0f0a
...
@@ -182,24 +182,26 @@ class KafkaFlowAsinDetail(Templates):
...
@@ -182,24 +182,26 @@ class KafkaFlowAsinDetail(Templates):
StructField
(
"follow_sellers"
,
IntegerType
(),
True
),
StructField
(
"follow_sellers"
,
IntegerType
(),
True
),
StructField
(
"fbm_delivery_price"
,
FloatType
(),
True
),
StructField
(
"fbm_delivery_price"
,
FloatType
(),
True
),
StructField
(
"product_json"
,
StringType
(),
True
),
StructField
(
"product_json"
,
StringType
(),
True
),
StructField
(
"amazon_label"
,
StringType
(),
True
)
StructField
(
"amazon_label"
,
StringType
(),
True
),
StructField
(
"landing_asin"
,
StringType
(),
True
)
])
])
return
schema
return
schema
# 0. 处理跳转asin:current_asin 非空时用其替换 asin(在去重前执行,保证跳转后的重复 asin 能被正确合并)
# 0. 处理跳转asin:landing_asin 非空时用其替换 asin(在去重前执行,保证跳转后的重复 asin 能被正确合并)
# current_asin 保留在df里不做处理,随数据一起落地,方便后续排查跳转是否准确
def
handle_asin_jump
(
self
,
df
):
def
handle_asin_jump
(
self
,
df
):
df
=
df
.
withColumn
(
df
=
df
.
withColumn
(
"asin"
,
"asin"
,
F
.
when
(
F
.
when
(
F
.
col
(
"
current_asin"
)
.
isNotNull
()
&
(
F
.
col
(
"current
_asin"
)
!=
""
),
F
.
col
(
"
landing_asin"
)
.
isNotNull
()
&
(
F
.
col
(
"landing
_asin"
)
!=
""
),
F
.
col
(
"
current
_asin"
)
F
.
col
(
"
landing
_asin"
)
)
.
otherwise
(
F
.
col
(
"asin"
))
)
.
otherwise
(
F
.
col
(
"asin"
))
)
.
drop
(
"
current
_asin"
)
)
.
drop
(
"
landing
_asin"
)
return
df
return
df
# 覆写模板去重方法:去重前先做
current
_asin 替换,确保跳转后同 asin 多条记录在去重时被合并
# 覆写模板去重方法:去重前先做
landing
_asin 替换,确保跳转后同 asin 多条记录在去重时被合并
def
deduplication_kafka_data
(
self
,
kafka_df
,
deduplicaiton_key_field
,
deduplication_time_field
):
def
deduplication_kafka_data
(
self
,
kafka_df
,
deduplicaiton_key_field
,
deduplication_time_field
):
if
deduplicaiton_key_field
==
"asin"
and
"
current
_asin"
in
kafka_df
.
columns
:
if
deduplicaiton_key_field
==
"asin"
and
"
landing
_asin"
in
kafka_df
.
columns
:
kafka_df
=
self
.
handle_asin_jump
(
kafka_df
)
kafka_df
=
self
.
handle_asin_jump
(
kafka_df
)
return
super
()
.
deduplication_kafka_data
(
kafka_df
,
deduplicaiton_key_field
,
deduplication_time_field
)
return
super
()
.
deduplication_kafka_data
(
kafka_df
,
deduplicaiton_key_field
,
deduplication_time_field
)
...
...
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