Commit 1f9e6422 authored by litaolemo's avatar litaolemo

update

parent 84b8ddd9
...@@ -395,6 +395,13 @@ WHERE partition_date>='{start_date}' AND partition_date<'{end_date}' and page_na ...@@ -395,6 +395,13 @@ WHERE partition_date>='{start_date}' AND partition_date<'{end_date}' and page_na
device_df = spark.sql(baoguang_sql) device_df = spark.sql(baoguang_sql)
device_df.show(1, False) device_df.show(1, False)
sql_res = device_df.collect() sql_res = device_df.collect()
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
print("-----------------------------------------------------------------------------")
for res in sql_res: for res in sql_res:
print(res) print(res)
print(res.query) print(res.query)
...@@ -402,17 +409,19 @@ WHERE partition_date>='{start_date}' AND partition_date<'{end_date}' and page_na ...@@ -402,17 +409,19 @@ WHERE partition_date>='{start_date}' AND partition_date<'{end_date}' and page_na
# for data in hive.cursor.fetchall(): # for data in hive.cursor.fetchall():
# data_dic[data[0]] = data[1] # data_dic[data[0]] = data[1]
# --query词曝光 # --query词曝光
query_sql = """ # query_sql = """
SELECT params['query_words'] # SELECT params['query_words']
FROM bl_hdfs_maidian_updates # FROM online.bl_hdfs_maidian_updates
WHERE partition_date>='{start_date}' AND partition_date<'{end_date}' # WHERE partition_date>='{start_date}' AND partition_date<'{end_date}'
AND action = 'report_status' # AND action = 'report_status'
AND page_name in ('search_home','search_home_more','search_home_welfare','search_home_diary','search_home_wiki','search_home_post','search_home_hospital','search_home_doctor') # AND page_name in ('search_home','search_home_more','search_home_welfare','search_home_diary','search_home_wiki','search_home_post','search_home_hospital','search_home_doctor')
""".format(start_date=start_date_str,end_date=end_date_str) # """.format(start_date=start_date_str,end_date=end_date_str)
#
device_df = spark.sql(baoguang_sql) # device_df = spark.sql(baoguang_sql)
device_df.show(1, False) # device_df.show(1, False)
device_df.collect() # sql_res = device_df.collect()
# for res in sql_res:
# print(res)
# for single_keyword in device_df[0]: # for single_keyword in device_df[0]:
# data_count = data_dic.get(single_keyword) # data_count = data_dic.get(single_keyword)
# if data_count: # if data_count:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment