From d175a9745f2d888152f007ce68c1b7694afdaf30 Mon Sep 17 00:00:00 2001 From: Giambattista Bloisi Date: Sat, 24 Feb 2024 16:54:30 +0100 Subject: [PATCH] Fix: invert the "natural" order when ordering by id lexicographically --- .../dnetlib/dhp/schema/oaf/utils/MergeEntitiesComparator.java | 2 +- .../eu/dnetlib/dhp/oa/dedup/SparkPublicationRootsTest2.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/MergeEntitiesComparator.java b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/MergeEntitiesComparator.java index ff6c2689a..5f212c242 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/MergeEntitiesComparator.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/MergeEntitiesComparator.java @@ -96,7 +96,7 @@ public class MergeEntitiesComparator implements Comparator { // id if (res == 0) { if (left instanceof OafEntity && right instanceof OafEntity) { - res = ((OafEntity) left).getId().compareTo(((OafEntity) right).getId()); + res = ((OafEntity) right).getId().compareTo(((OafEntity) left).getId()); } } diff --git a/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/SparkPublicationRootsTest2.java b/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/SparkPublicationRootsTest2.java index 72c37a9b9..429c367c3 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/SparkPublicationRootsTest2.java +++ b/dhp-workflows/dhp-dedup-openaire/src/test/java/eu/dnetlib/dhp/oa/dedup/SparkPublicationRootsTest2.java @@ -200,7 +200,7 @@ public class SparkPublicationRootsTest2 implements Serializable { assertEquals("2022-01-01", root.getDateofacceptance().getValue()); assertEquals(crossref_duplicate.getJournal().getName(), root.getJournal().getName()); assertEquals(crossref_duplicate.getJournal().getIssnPrinted(), root.getJournal().getIssnPrinted()); -// assertEquals(crossref_duplicate.getPublisher().getValue(), root.getPublisher().getValue()); + assertEquals(crossref_duplicate.getPublisher().getValue(), root.getPublisher().getValue()); Set rootPids = root .getPid()