Commit 5649b836 by WangJinfeng

update rtdmp add lazada

parent 7b1a078b
...@@ -28,13 +28,21 @@ object Constant { ...@@ -28,13 +28,21 @@ object Constant {
val merge_install_sql: String = val merge_install_sql: String =
""" """
|SELECT campaign_id, gaid, '@new_date' update_date |SELECT
| COALESCE(t1.campaign_id, t2.campaign_id) campaign_id,
| COALESCE(t1.gaid, t2.gaid) gaid,
| COALESCE(t1.update_date, t2.update_date) update_date
| FROM
| (SELECT campaign_id, gaid, '@new_date' update_date
| FROM dwh.etl_adn_tracking_install | FROM dwh.etl_adn_tracking_install
| WHERE dt = '@dt' | WHERE dt = '@dt'
| UNION ALL | ) t1
|SELECT campaign_id, gaid, update_date | FULL OUTER JOIN
| (SELECT campaign_id, gaid, update_date
| FROM dwh.merge_adn_tracking_install | FROM dwh.merge_adn_tracking_install
| WHERE dt = '@dt' AND update_date > '@update_date' | WHERE dt = '@dt' AND update_date > '@update_date'
| ) t2
| ON t1.campaign_id = t2.campaign_id AND t1.gaid = t2.gaid
|""".stripMargin |""".stripMargin
val process_rtdmp_audience_sql: String = val process_rtdmp_audience_sql: String =
......
...@@ -37,10 +37,13 @@ class MergeInstallJob extends CommonSparkJob with Serializable { ...@@ -37,10 +37,13 @@ class MergeInstallJob extends CommonSparkJob with Serializable {
val update_date = DateUtil.getDay(DateUtil.parse(dt, "yyyyMMdd"), "yyyy-MM-dd", -30) val update_date = DateUtil.getDay(DateUtil.parse(dt, "yyyyMMdd"), "yyyy-MM-dd", -30)
val before_date = DateUtil.getDay(DateUtil.parse(dt, "yyyyMMdd"), "yyyyMMdd", -1)
val sql: String = Constant.merge_install_sql val sql: String = Constant.merge_install_sql
.replace("@dt", dt) .replace("@dt", dt)
.replace("@new_date", new_date) .replace("@new_date", new_date)
.replace("@update_date", update_date) .replace("@update_date", update_date)
.replace("@before_date", before_date)
spark.sql(sql) spark.sql(sql)
.coalesce(100) .coalesce(100)
......
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