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
143d61c1
Commit
143d61c1
authored
Aug 03, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
a05de552
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
dwt_aba_st_analytics_report.py
Pyspark_job/dwt/dwt_aba_st_analytics_report.py
+13
-0
No files found.
Pyspark_job/dwt/dwt_aba_st_analytics_report.py
View file @
143d61c1
...
@@ -17,6 +17,8 @@ import sys
...
@@ -17,6 +17,8 @@ import sys
sys
.
path
.
append
(
os
.
path
.
dirname
(
sys
.
path
[
0
]))
# 上级目录
sys
.
path
.
append
(
os
.
path
.
dirname
(
sys
.
path
[
0
]))
# 上级目录
from
utils.templates
import
Templates
from
utils.templates
import
Templates
from
utils.common_util
import
CommonUtil
from
utils.hdfs_utils
import
HdfsUtils
# 分组排序的udf窗口函数
# 分组排序的udf窗口函数
from
pyspark.sql.window
import
Window
from
pyspark.sql.window
import
Window
from
pyspark.sql
import
functions
as
F
from
pyspark.sql
import
functions
as
F
...
@@ -62,6 +64,17 @@ class DwtAbaStAnalyticsReport(Templates):
...
@@ -62,6 +64,17 @@ class DwtAbaStAnalyticsReport(Templates):
self
.
partitions_by
=
[
'site_name'
,
'date_type'
,
'date_info'
]
self
.
partitions_by
=
[
'site_name'
,
'date_type'
,
'date_info'
]
self
.
reset_partitions
(
65
)
self
.
reset_partitions
(
65
)
# 落表走 Templates.save_data 的 saveAsTable(mode='append'),不会覆盖旧数据
# 所以写之前先清掉本次分区目录下的文件,同一分区重跑不会追加成两份
partition_dict
=
{
"site_name"
:
self
.
site_name
,
"date_type"
:
self
.
date_type
,
"date_info"
:
self
.
date_info
,
}
hdfs_path
=
CommonUtil
.
build_hdfs_path
(
self
.
db_save
,
partition_dict
=
partition_dict
)
print
(
f
"清除hdfs目录中.....{hdfs_path}"
)
HdfsUtils
.
delete_file_in_folder
(
hdfs_path
)
self
.
u_get_buy_box_num
=
self
.
spark
.
udf
.
register
(
"u_get_buy_box_num"
,
self
.
udf_get_buy_box_num
,
StringType
())
self
.
u_get_buy_box_num
=
self
.
spark
.
udf
.
register
(
"u_get_buy_box_num"
,
self
.
udf_get_buy_box_num
,
StringType
())
self
.
u_get_buy_box
=
self
.
spark
.
udf
.
register
(
"u_get_buy_box"
,
self
.
udf_get_buy_box_type
,
StringType
())
self
.
u_get_buy_box
=
self
.
spark
.
udf
.
register
(
"u_get_buy_box"
,
self
.
udf_get_buy_box_type
,
StringType
())
self
.
u_get_img_type
=
self
.
spark
.
udf
.
register
(
"u_get_img_type"
,
self
.
udf_get_img_type
,
StringType
())
self
.
u_get_img_type
=
self
.
spark
.
udf
.
register
(
"u_get_img_type"
,
self
.
udf_get_img_type
,
StringType
())
...
...
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