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
b9f55f1b
Commit
b9f55f1b
authored
Oct 15, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keepa数据增加类型解析
parent
7490b842
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
dim_keepa_asin_info.py
Pyspark_job/dim/dim_keepa_asin_info.py
+10
-5
No files found.
Pyspark_job/dim/dim_keepa_asin_info.py
View file @
b9f55f1b
...
...
@@ -63,7 +63,9 @@ class DimKeepaAsinInfo(object):
F
.
get_json_object
(
"last_detail"
,
"$.trackingSince"
)
.
cast
(
"int"
)
.
alias
(
"tracking_since"
),
F
.
get_json_object
(
"last_detail"
,
"$.productType"
)
.
cast
(
"int"
)
.
alias
(
"product_type"
),
F
.
get_json_object
(
"last_detail"
,
"$.title"
)
.
alias
(
"title"
),
F
.
col
(
'updated_time'
)
F
.
col
(
'updated_time'
),
F
.
lower
(
F
.
regexp_replace
(
F
.
get_json_object
(
"last_detail"
,
"$.type"
),
"_"
,
"-"
))
.
alias
(
"keepa_type"
),
F
.
lower
(
F
.
regexp_replace
(
F
.
get_json_object
(
"last_detail"
,
"$.itemTypeKeyword"
),
"_"
,
"-"
))
.
alias
(
"keepa_item_type"
)
)
.
withColumn
(
# weight 字段已废弃(Doris 端 dwd_keepa_asin_detail 不再保留),Hive 兼容 schema 保留列但置 NULL
'weight'
,
F
.
lit
(
None
)
.
cast
(
'int'
)
...
...
@@ -93,7 +95,9 @@ class DimKeepaAsinInfo(object):
F
.
col
(
'release_date'
),
F
.
col
(
'tracking_since'
),
F
.
col
(
'product_type'
),
F
.
col
(
'title'
)
F
.
col
(
'title'
),
F
.
col
(
'keepa_type'
),
F
.
col
(
'keepa_item_type'
)
)
.
filter
(
# 过滤脏数据:productType in (3,4,5) 且 title 为空的异常数据不做保留
~
(
F
.
col
(
"product_type"
)
.
isin
(
3
,
4
,
5
)
&
F
.
col
(
"title"
)
.
isNull
())
...
...
@@ -105,12 +109,13 @@ class DimKeepaAsinInfo(object):
'asin'
,
'package_length'
,
'package_width'
,
'package_height'
,
'package_weight'
,
'item_weight'
,
'listed_since'
,
'release_date'
,
'tracking_since'
,
F
.
to_timestamp
(
F
.
col
(
'keepa_launch_time'
))
.
alias
(
'keepa_launch_time'
),
F
.
to_timestamp
(
F
.
col
(
'updated_time'
))
.
alias
(
'updated_time'
)
F
.
to_timestamp
(
F
.
col
(
'updated_time'
))
.
alias
(
'updated_time'
),
'keepa_type'
,
'keepa_item_type'
)
# 读取历史数据
sql
=
f
"""
select asin, package_length, package_width, package_height, package_weight, item_weight, weight, keepa_launch_time, updated_time, listed_since, release_date, tracking_since, product_type, title
select asin, package_length, package_width, package_height, package_weight, item_weight, weight, keepa_launch_time, updated_time, listed_since, release_date, tracking_since, product_type, title
, keepa_type, keepa_item_type
from dim_keepa_asin_info where site_name = '{self.site_name}';
"""
self
.
df_keepa_asin_history
=
self
.
spark
.
sql
(
sqlQuery
=
sql
)
.
repartition
(
40
,
'asin'
)
.
cache
()
...
...
@@ -167,7 +172,7 @@ class DimKeepaAsinInfo(object):
print
(
"往doris存储最新keepa详情信息:"
)
doris_table_columns
=
"""
site_name, asin, package_length, package_width, package_height, package_weight, item_weight,
listed_since, release_date, tracking_since, keepa_launch_time, updated_time
listed_since, release_date, tracking_since, keepa_launch_time, updated_time
, keepa_type, keepa_item_type
"""
DorisHelper
.
spark_export_with_columns
(
df_save
=
self
.
df_to_doris
,
...
...
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