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
59a752c1
Commit
59a752c1
authored
Aug 10, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asin跳转逻辑封装udf
parent
e1b1a1f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
common_udf.py
Pyspark_job/yswg_utils/common_udf.py
+15
-0
No files found.
Pyspark_job/yswg_utils/common_udf.py
View file @
59a752c1
...
@@ -916,3 +916,18 @@ def udf_detect_phrase_reg(lang_word_map):
...
@@ -916,3 +916,18 @@ def udf_detect_phrase_reg(lang_word_map):
return
{
"lang"
:
lang
,
"hint_word"
:
hint_word
}
return
{
"lang"
:
lang
,
"hint_word"
:
hint_word
}
pass
pass
return
F
.
udf
(
detect_phrase
,
MapType
(
StringType
(),
StringType
()))
return
F
.
udf
(
detect_phrase
,
MapType
(
StringType
(),
StringType
()))
def
resolve_asin_jump
(
asin_col
=
'asin'
,
current_asin_col
=
'current_asin'
):
"""asin跳转判断(分支拆开写,方便后续单独扩展特例):
- current_asin 为空 → 不跳转,保留 asin
- current_asin 为合法10位字母数字ASIN码 → 跳转,取 current_asin
- current_asin 长度大于10(代表母体可卖)→ 不跳转,保留 asin
- 其余未覆盖情况 → 默认不跳转,保留 asin
"""
current
=
F
.
col
(
current_asin_col
)
asin
=
F
.
col
(
asin_col
)
return
F
.
when
(
current
.
isNull
()
|
(
current
==
''
),
asin
)
\
.
when
(
current
.
rlike
(
r'^[A-Za-z0-9]{10}$'
),
current
)
\
.
when
(
F
.
length
(
current
)
>
10
,
asin
)
\
.
otherwise
(
asin
)
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