code formatter

This commit is contained in:
Sandro La Bruzzo 2022-04-22 11:08:13 +02:00
parent aa12429f50
commit a82ec3aaaf
1 changed files with 6 additions and 12 deletions

View File

@ -129,11 +129,9 @@ object SparkGenerateDoiBoost {
.map(DoiBoostMappingUtil.fixPublication) .map(DoiBoostMappingUtil.fixPublication)
.map(p => (p.getId, p)) .map(p => (p.getId, p))
.groupByKey(_._1) .groupByKey(_._1)
.reduceGroups((left, right) => .reduceGroups((left, right) => {
{
//Check left is not null //Check left is not null
if (left != null && left._1 != null) if (left != null && left._1 != null) {
{
//If right is null then return left //If right is null then return left
if (right == null || right._2 == null) if (right == null || right._2 == null)
left left
@ -151,21 +149,17 @@ object SparkGenerateDoiBoost {
//Return publication Merged //Return publication Merged
(b1.getId, b1) (b1.getId, b1)
} }
} } else {
else {
// Left is Null so we return right // Left is Null so we return right
right right
} }
} })
.filter(s => s != null && s._2 != null)
)
.filter(s => s!= null && s._2!=null)
.map(s => s._2._2) .map(s => s._2._2)
.write .write
.mode(SaveMode.Overwrite) .mode(SaveMode.Overwrite)
.save(s"$workingDirPath/doiBoostPublicationFiltered") .save(s"$workingDirPath/doiBoostPublicationFiltered")
val affiliationPath = parser.get("affiliationPath") val affiliationPath = parser.get("affiliationPath")
val paperAffiliationPath = parser.get("paperAffiliationPath") val paperAffiliationPath = parser.get("paperAffiliationPath")
@ -290,4 +284,4 @@ object SparkGenerateDoiBoost {
.save(s"$workingDirPath/doiBoostOrganization") .save(s"$workingDirPath/doiBoostOrganization")
} }
} }