Commit cc08fb0d by wangjf

fix

parent c141ffb5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
DT=$(date +%Y%m%d -d "-1 day $ScheduleTime") DT=$(date +%Y%m%d -d "-1 day $ScheduleTime")
LAST_DT=$(date +%Y%m%d -d "-30 day $DT") START_DT=$(date +%Y-%m-%d -d "-30 day $DT")
END_DT=$(date +%Y-%m-%d -d "-1 day $DT")
hive -hivevar dt=${DT} -hivevar last_dt=${LAST_DT} -f app_start.sql hive -hivevar dt=${DT} -hivevar start_dt=${START_DT} -hivevar end_dt=${END_DT} -f app_start.sql
\ No newline at end of file \ No newline at end of file
...@@ -9,10 +9,8 @@ SET hive.mapred.mode=nonstrict; ...@@ -9,10 +9,8 @@ SET hive.mapred.mode=nonstrict;
DROP TABLE IF EXISTS package_num; DROP TABLE IF EXISTS package_num;
CREATE TABLE package_num AS SELECT package_name,count(1) install_num FROM dwh.dm_install_list_v2 CREATE TABLE package_num AS SELECT package_name,count(1) install_num FROM dwh.dm_install_list_v2
WHERE dt = '${dt}' AND update_date BETWEEN '${LAST_DT}' AND '${dt}' WHERE dt = '${dt}' AND update_date BETWEEN '${start_dt}' AND '${end_dt}'
AND package_name NOT IN (SELECT distinct package_name FROM dwh.dim_package_tags) GROUP BY package_name HAVING count(1) > 30000;
GROUP BY package_name HAVING count(1) > 30000
ORDER BY install_num DESC LIMIT 5000;
DROP TABLE IF EXISTS package_info; DROP TABLE IF EXISTS package_info;
CREATE TABLE package_info AS CREATE TABLE package_info AS
...@@ -25,6 +23,6 @@ CREATE TABLE package_info AS ...@@ -25,6 +23,6 @@ CREATE TABLE package_info AS
DROP TABLE IF EXISTS package_list; DROP TABLE IF EXISTS package_list;
CREATE TABLE package_list AS CREATE TABLE package_list AS
SELECT /*+ mapjoin(t)*/ p.package_name,p.app_name,p.platform,p.track_view_url,p.category_list,t.install_num SELECT /*+ mapjoin(t)*/ p.package_name,p.app_name,p.platform,p.track_view_url,p.category_list,t.install_num
FROM package_num t FROM (SELECT * FROM package_num WHERE package_name NOT IN (SELECT DISTINCT package_name FROM dwh.dim_package_tags)) t
JOIN package_info p JOIN package_info p
ON t.package_name = p.package_name; ON t.package_name = p.package_name ORDER BY t.install_num LIMIT 5000;
\ No newline at end of file \ No newline at end of file
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