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
5c0d4918
Commit
5c0d4918
authored
Nov 27, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7c1cfdb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
daily_search_word_count_last_two_year.py
task/daily_search_word_count_last_two_year.py
+6
-3
No files found.
task/daily_search_word_count_last_two_year.py
View file @
5c0d4918
...
...
@@ -157,6 +157,7 @@ tableDF4 = spark.read.format("jdbc"). \
task_list
=
[]
task_days
=
2
keyword_dict
=
{}
for
t
in
range
(
1
,
task_days
):
day_num
=
0
-
t
now
=
(
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
days
=
day_num
))
...
...
@@ -174,13 +175,15 @@ for t in range(1, task_days):
select name from wiki_brand where is_online=True
"""
keyword_df
=
spark
.
sql
(
keyword_sql
)
keyword_df
.
createOrReplaceTempView
(
"keywords_table"
)
# keyword_df.createOrReplaceTempView("keywords_table")
res
=
keyword_df
.
collect
()
for
r
in
res
:
keyword_dict
[
r
.
name
]
=
1
sql_search_ctr
=
r"""
SELECT query,
all_search_uv as all_search_uv, --全部搜索uv
all_search_pv as all_search_pv, --全部搜索pv
(if `query` IN(select name from keywords_table), 0, 1) as is_delete
FROM (
--搜索pvuv
SELECT query
...
...
@@ -304,7 +307,7 @@ for t in range(1, task_days):
uv
=
name
.
all_search_uv
is_tag
=
tag_dict
.
get
(
keywords
,
0
)
servise_num
=
from_es_get_service_num
(
keywords
)
is_delete
=
name
.
is_delete
is_delete
=
0
if
keyword_dict
.
get
(
keywords
)
else
1
# pid = hashlib.md5((today_str + keywords).encode("utf8")).hexdigest()
tag_names_list_week
.
append
((
key_count
,
keywords
,
today_str
,
is_delete
,
servise_num
,
pv
,
is_tag
))
...
...
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