Fix conditions that prevented ORCID Enrichment

This commit is contained in:
Giambattista Bloisi 2024-03-22 16:24:49 +01:00
parent 9092075760
commit 0ff7faad72
2 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ object ORCIDAuthorEnricher extends Serializable {
) = { ) = {
val matched = scala.collection.mutable.ArrayBuffer.empty[MatchedAuthors] val matched = scala.collection.mutable.ArrayBuffer.empty[MatchedAuthors]
if (graph_authors != null && graph_authors.isEmpty) { if (graph_authors != null && !graph_authors.isEmpty) {
val ait = graph_authors.iterator val ait = graph_authors.iterator
while (ait.hasNext) { while (ait.hasNext) {

View File

@ -72,7 +72,7 @@ class SparkEnrichGraphWithOrcidAuthors(propertyPath: String, args: Array[String]
.join(matched, Seq("id"), "left") .join(matched, Seq("id"), "left")
.withColumn( .withColumn(
"author", "author",
when(size(col("enriched_author")).gt(1), col("enriched_author")) when(size(col("enriched_author")).gt(0), col("enriched_author"))
.otherwise(col("author")) .otherwise(col("author"))
) )
.drop("enriched_author") .drop("enriched_author")