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
5cebd332
Commit
5cebd332
authored
Jul 07, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复日榜单asin传入date_info时环比计算异常
parent
847f7bca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
kafka_flow_asin_detail_to_doris.py
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
+18
-4
No files found.
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
View file @
5cebd332
...
...
@@ -838,11 +838,25 @@ class KafkaFlowAsinDetail(Templates):
F
.
col
(
'asin_bought_month'
)
.
alias
(
f
'{alias_prefix}_asin_bought_month'
),
)
.
persist
(
StorageLevel
.
DISK_ONLY
)
print
(
f
"1a. 读取上个月维度的flow_asin(date_type=month, date_info={self.date_info_last_month})"
)
self
.
df_previous_flow_asin
=
_load_baseline
(
self
.
date_info_last_month
,
'previous'
)
# 从MySQL流程记录表获取最新已产出月份,避免查Hive慢
_engine_mysql
=
DBUtil
.
get_db_engine
(
'mysql'
,
'us'
)
_sql_latest
=
(
f
"SELECT MAX(report_date) "
f
"FROM workflow_everyday "
f
"WHERE site_name='{self.site_name}' AND date_type='month' "
f
"AND page='流量选品' AND status_val=14 AND is_end='是'"
)
_result
=
list
(
DBUtil
.
engine_exec_sql
(
_engine_mysql
,
_sql_latest
))
actual_last_month
=
(
_result
[
0
][
0
]
if
_result
and
_result
[
0
][
0
]
else
self
.
date_info_last_month
)
actual_last_year
=
CommonUtil
.
get_month_offset
(
actual_last_month
,
-
11
)
print
(
f
"环比基线月:{actual_last_month}(原始推算:{self.date_info_last_month}),同比基线月:{actual_last_year}"
)
print
(
f
"1a. 读取上个月维度的flow_asin(date_type=month, date_info={actual_last_month})"
)
self
.
df_previous_flow_asin
=
_load_baseline
(
actual_last_month
,
'previous'
)
self
.
df_previous_flow_asin
.
show
(
10
,
truncate
=
False
)
print
(
f
"1b. 读取同比去年的flow_asin(date_type=month, date_info={
self.date_info
_last_year})"
)
self
.
df_previous_flow_asin_lastyear
=
_load_baseline
(
self
.
date_info
_last_year
,
'lastyear'
)
print
(
f
"1b. 读取同比去年的flow_asin(date_type=month, date_info={
actual
_last_year})"
)
self
.
df_previous_flow_asin_lastyear
=
_load_baseline
(
actual
_last_year
,
'lastyear'
)
self
.
df_previous_flow_asin_lastyear
.
show
(
10
,
truncate
=
False
)
print
(
"2. 获取店铺相关信息"
)
sql
=
f
"""
...
...
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