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
4aee7409
Commit
4aee7409
authored
Jul 09, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流量选品30天-同环比计算逻辑优化
parent
9ad3c214
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
kafka_flow_asin_detail_to_doris.py
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
+11
-5
No files found.
Pyspark_job/my_kafka/kafka_flow_asin_detail_to_doris.py
View file @
4aee7409
...
...
@@ -646,15 +646,21 @@ class KafkaFlowAsinDetail(Templates):
]
def
calculate_change
(
current_col
,
previous_col
):
rise_col
=
F
.
col
(
current_col
)
-
F
.
col
(
previous_col
)
curr
=
F
.
when
(
F
.
col
(
current_col
)
<
0
,
F
.
lit
(
None
))
.
otherwise
(
F
.
col
(
current_col
))
prev
=
F
.
when
(
F
.
col
(
previous_col
)
<
0
,
F
.
lit
(
None
))
.
otherwise
(
F
.
col
(
previous_col
))
rise_col
=
curr
-
prev
change_col
=
F
.
when
(
F
.
col
(
current_col
)
.
isNull
()
&
F
.
col
(
previous_col
)
.
isNull
(),
F
.
lit
(
None
)
curr
.
isNull
()
&
prev
.
isNull
(),
F
.
lit
(
None
)
)
.
when
(
F
.
col
(
current_col
)
.
isNull
(),
F
.
lit
(
-
100
0.0
)
curr
.
isNull
()
&
(
prev
==
0
),
F
.
lit
(
0.0
)
)
.
when
(
F
.
col
(
previous_col
)
.
isNull
()
|
(
F
.
col
(
previous_col
)
==
0
),
F
.
lit
(
1000.0
)
curr
.
isNull
(),
F
.
lit
(
-
1000.0
)
)
.
when
(
(
prev
.
isNull
()
|
(
prev
==
0
))
&
(
curr
==
0
),
F
.
lit
(
0.0
)
)
.
when
(
prev
.
isNull
()
|
(
prev
==
0
),
F
.
lit
(
1000.0
)
)
.
otherwise
(
F
.
round
((
F
.
col
(
current_col
)
-
F
.
col
(
previous_col
))
/
F
.
col
(
previous_col
)
,
4
)
F
.
round
((
curr
-
prev
)
/
prev
,
4
)
)
return
rise_col
,
change_col
...
...
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