One result linked to more than on project is saved just once

This commit is contained in:
Miriam Baglioni 2021-07-13 18:15:35 +02:00
parent 320cf02d96
commit 886617afd0
1 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,11 @@ public class SparkResultLinkedToProject implements Serializable {
"on rel.target = p.id " + "on rel.target = p.id " +
"") "")
.as(Encoders.bean(inputClazz)) .as(Encoders.bean(inputClazz))
.groupByKey(
(MapFunction< R, String>) value -> value
.getId(),
Encoders.STRING())
.mapGroups((MapGroupsFunction<String, R, R>) (k, it) -> it.next(), Encoders.bean(inputClazz))
.write() .write()
.mode(SaveMode.Overwrite) .mode(SaveMode.Overwrite)
.option("compression", "gzip") .option("compression", "gzip")