Commit d311d1b6 authored by litaolemo's avatar litaolemo

update

parent a5a75a9c
......@@ -91,8 +91,11 @@ for t in range(2, task_days):
yesterday_str_format = (now + datetime.timedelta(days=-1)).strftime("%Y-%m-%d")
one_week_age_str = (now + datetime.timedelta(days=-7)).strftime("%Y%m%d")
new_urser_device_id_sql = r"""
select cl_type,app_version,count(app_version) as count_num from (select cl_type,app_version,cl_id from online.bl_hdfs_maidian_updates where partition_date >= "20200201" group by cl_type,app_version,cl_id) group by cl_type,app_version
""".format(start_date="20210201", end_date="20200222", today_str_format=today_str_format,tomorrow_str=tomorrow_str)
select cl_type,app_version,count(app_version) as count_num from
( select *,rank() over(partition by cl_id order by partition_date desc) as ranking from
(select cl_type,app_version,cl_id,partition_date from online.bl_hdfs_maidian_updates where partition_date >= "20200201" group by cl_type,app_version,cl_id,partition_date)
) where ranking =1 group by cl_type,app_version
""".format(start_date="20210101", end_date="20200222", today_str_format=today_str_format,tomorrow_str=tomorrow_str)
# print(new_urser_device_id_sql)
new_urser_device_id_df = spark.sql(new_urser_device_id_sql)
......
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