Commit 579a1180 by WangJinfeng

fix m all devid

parent b8a85cf4
...@@ -18,6 +18,7 @@ class InstallListLogic extends CommonInstallListOrc { ...@@ -18,6 +18,7 @@ class InstallListLogic extends CommonInstallListOrc {
def processDailyData(business: String, date: String, spark: SparkSession): DataFrame = { def processDailyData(business: String, date: String, spark: SparkSession): DataFrame = {
val dateTime = DateUtil.format(DateUtil.parse(date, "yyyyMMdd"), "yyyy-MM-dd") val dateTime = DateUtil.format(DateUtil.parse(date, "yyyyMMdd"), "yyyy-MM-dd")
val expireDateTime = DateUtil.getDay(DateUtil.parse(date, "yyyyMMdd"), "yyyy-MM-dd", -365)
var sql = "" var sql = ""
business match { business match {
case "3s" => case "3s" =>
...@@ -36,12 +37,12 @@ class InstallListLogic extends CommonInstallListOrc { ...@@ -36,12 +37,12 @@ class InstallListLogic extends CommonInstallListOrc {
spark.udf.register("toJsonBySplit", MobvistaConstant.toJsonBySplit _) spark.udf.register("toJsonBySplit", MobvistaConstant.toJsonBySplit _)
spark.udf.register("parseMExtData", MobvistaConstant.parseMExtData _) spark.udf.register("parseMExtData", MobvistaConstant.parseMExtData _)
sql = MobvistaConstant.adn_reuqest_sdk_sql.replace("@dt", date) sql = MobvistaConstant.adn_reuqest_sdk_sql.replace("@dt", date)
.replace("@update_date", dateTime) .replace("@update_date", expireDateTime)
case "adn_request_unmatch" => case "adn_request_unmatch" =>
spark.udf.register("toJsonBySplit", MobvistaConstant.toJsonBySplit _) spark.udf.register("toJsonBySplit", MobvistaConstant.toJsonBySplit _)
spark.udf.register("parseMExtData", MobvistaConstant.parseMExtData _) spark.udf.register("parseMExtData", MobvistaConstant.parseMExtData _)
sql = MobvistaConstant.adn_reuqest_sdk_unmatch_sql.replace("@dt", date) sql = MobvistaConstant.adn_reuqest_sdk_unmatch_sql.replace("@dt", date)
.replace("@update_date", dateTime) .replace("@update_date", expireDateTime)
case "adn_sdk" => case "adn_sdk" =>
spark.udf.register("toJsonString", MobvistaConstant.toJsonString _) spark.udf.register("toJsonString", MobvistaConstant.toJsonString _)
sql = MobvistaConstant.adn_sdk_sql.replace("@dt", date).replace("@version", "0") sql = MobvistaConstant.adn_sdk_sql.replace("@dt", date).replace("@version", "0")
...@@ -75,7 +76,7 @@ class InstallListLogic extends CommonInstallListOrc { ...@@ -75,7 +76,7 @@ class InstallListLogic extends CommonInstallListOrc {
spark.udf.register("toPkgJson", MobvistaConstant.toPkgJson _) spark.udf.register("toPkgJson", MobvistaConstant.toPkgJson _)
spark.udf.register("parseDSPExtData", MobvistaConstant.parseDSPExtData _) spark.udf.register("parseDSPExtData", MobvistaConstant.parseDSPExtData _)
sql = MobvistaConstant.dsp_req_unmatch_sql.replace("@dt", date) sql = MobvistaConstant.dsp_req_unmatch_sql.replace("@dt", date)
.replace("@update_date", dateTime) .replace("@update_date", expireDateTime)
case "facebook" => case "facebook" =>
spark.udf.register("toPkgJson", MobvistaConstant.toPkgJson _) spark.udf.register("toPkgJson", MobvistaConstant.toPkgJson _)
sql = MobvistaConstant.facebook_sql.replace("@dt", date) sql = MobvistaConstant.facebook_sql.replace("@dt", date)
......
...@@ -64,7 +64,7 @@ object MobvistaConstant { ...@@ -64,7 +64,7 @@ object MobvistaConstant {
""" """
|SELECT device_id, device_type, platform, MAX(country) country, toJsonBySplit(CONCAT_WS(';',COLLECT_SET(package_name)), platform, '@update_date') install_list, |SELECT device_id, device_type, platform, MAX(country) country, toJsonBySplit(CONCAT_WS(';',COLLECT_SET(package_name)), platform, '@update_date') install_list,
| parseMExtData(CONCAT_WS(',',COLLECT_SET(strategy)), CONCAT_WS(',',COLLECT_SET(region)), MAX(dev_tag)) ext_data | parseMExtData(CONCAT_WS(',',COLLECT_SET(strategy)), CONCAT_WS(',',COLLECT_SET(region)), MAX(dev_tag)) ext_data
| FROM dwh.etl_adn_request_sdk_unmatch WHERE `dt` = '@dt' AND update_date = '@update_date' AND check_device(device_id) | FROM dwh.etl_adn_request_sdk_unmatch WHERE `dt` = '@dt' AND update_date >= '@update_date' AND check_device(device_id)
| GROUP BY device_id, device_type, platform | GROUP BY device_id, device_type, platform
""".stripMargin """.stripMargin
......
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