Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
Project
Project
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
黎涛
meta_base_code
Commits
6fbccf3b
Commit
6fbccf3b
authored
Sep 17, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cb420e54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
new_user_has_protratit_rate.py
new_user_analysis/new_user_has_protratit_rate.py
+27
-0
No files found.
new_user_analysis/new_user_has_protratit_rate.py
View file @
6fbccf3b
...
...
@@ -240,3 +240,30 @@ WHERE spam_pv.device_id IS NULL
print
(
res
)
# cursor.executemany()
db
.
close
()
res_dict
=
{}
maidian_sql
=
"""select t1.device_id,t2.track as track from
(select device_id from device_id_view where device_id in {device_id_tuple})t1
left join
(select cl_id, concat_ws(',', collect_list(action)) as track from
(select * from online.bl_hdfs_maidian_updates where partition_date = {partition_date} and cl_id is not null ) group by cl_id) t2
on t1.device_id = t2.cl_id"""
.
format
(
partition_date
=
today_str
,
device_id_tuple
=
str
(
tuple
(
no_portrait_device_id_list
)))
print
(
maidian_sql
)
track_df
=
spark
.
sql
(
maidian_sql
)
# track_df.createOrReplaceTempView("device_id_view")
track_df
.
show
(
1
)
sql_res
=
track_df
.
collect
()
print
(
"-------------------------------"
)
for
count
,
res
in
enumerate
(
sql_res
):
# print(count, res)
track
=
res
.
track
if
not
track
:
continue
track_list
=
track
.
split
(
","
)
for
one_key_word
in
track_list
:
if
one_key_word
in
res_dict
:
res_dict
[
one_key_word
]
+=
1
else
:
res_dict
[
one_key_word
]
=
1
print
(
res_dict
)
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