|
@@ -51,6 +51,12 @@ case class NgCompanyDynamic(s: SparkSession,
|
|
|
| ds STRING COMMENT '分区'
|
|
|
|)
|
|
|
|""".stripMargin)
|
|
|
+
|
|
|
+ val i = agg.flatMap(_.tabs).map((_, 1)).groupBy(_._1)
|
|
|
+ .mapValues(_.foldLeft(0)(_ + _._2)).count(_._2 >= 2)
|
|
|
+ if (i > 0) {
|
|
|
+ throw new RuntimeException("agg.tn 有交叉")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
def calc(): Unit = {
|
|
@@ -96,6 +102,7 @@ case class NgCompanyDynamic(s: SparkSession,
|
|
|
if (elem.group_by_key == null) {
|
|
|
tmp_rdd = rdd.filter(r => elem.tn.equals(r.tn))
|
|
|
} else {
|
|
|
+
|
|
|
tmp_rdd = rdd.filter(r => elem.tn.equals(r.tn))
|
|
|
.groupBy(r => args_map(elem.tn).group_by_key.apply(r))
|
|
|
.flatMap(r => args_map(elem.tn).group_by_flat_map(r._2.toSeq))
|
|
@@ -113,7 +120,13 @@ case class NgCompanyDynamic(s: SparkSession,
|
|
|
}
|
|
|
rdd_map = rdd_map - tn
|
|
|
}
|
|
|
- tmp_rdd = tmp_rdd.groupBy(elem.group_by_key).flatMap(r => elem.group_by_flat_map.apply(r._2.toSeq))
|
|
|
+ if (elem.group_by_pre == null) {
|
|
|
+ tmp_rdd = tmp_rdd.groupBy(elem.group_by_key).flatMap(r => elem.group_by_flat_map.apply(r._2.toSeq))
|
|
|
+ } else {
|
|
|
+ tmp_rdd = tmp_rdd
|
|
|
+ .flatMap(r => elem.group_by_pre.apply(r))
|
|
|
+ .groupBy(elem.group_by_key).flatMap(r => elem.group_by_flat_map.apply(r._2.toSeq))
|
|
|
+ }
|
|
|
rdd_map = rdd_map + (elem.tabs.mkString("_") -> tmp_rdd)
|
|
|
}
|
|
|
|