|
@@ -70,10 +70,16 @@ case class CompanyIncrCombineUtils(s: SparkSession, source: String, target: Stri
|
|
|
!s.equals("ds")
|
|
|
})
|
|
|
|
|
|
+ //判断是否包含id字段
|
|
|
+ var app_sql = ""
|
|
|
+ if (cols.contains("id")) {
|
|
|
+ app_sql = " id = -1 and "
|
|
|
+ }
|
|
|
+
|
|
|
//判断目标表是否之前合并过
|
|
|
val list = sql(
|
|
|
s"""
|
|
|
- |select max(ds) max_ds from $target where id = -1 and ds > '0'
|
|
|
+ |select max(ds) max_ds from $target where $app_sql ds > '0'
|
|
|
|""".stripMargin).collect().toList.map(_.getAs[String]("max_ds"))
|
|
|
|
|
|
println(s"list: $list" + s", ds: $ds2")
|