From 2e4cab026c7707549414eb9be872e3f91c83a592 Mon Sep 17 00:00:00 2001 From: Antonis Lempesis Date: Mon, 8 Jan 2024 16:01:26 +0200 Subject: [PATCH] fixed the result_country definition --- .../scripts/step16-createIndicatorsTables.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step16-createIndicatorsTables.sql b/dhp-workflows/dhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step16-createIndicatorsTables.sql index f8213030e..daef003df 100755 --- a/dhp-workflows/dhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step16-createIndicatorsTables.sql +++ b/dhp-workflows/dhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step16-createIndicatorsTables.sql @@ -1210,6 +1210,10 @@ where ri.license is not null and datasource.type like '%Repository%' and datasou on p.id= tmp.id; create table ${stats_db_name}.result_country stored as parquet as -select distinct ro.id, o.country from ${stats_db_name}.result_organization ro -join ${stats_db_name}.organization o on o.id=ro.organization -join ${stats_db_name}.funder f on f.country=o.country; \ No newline at end of file +select distinct ro.id, coalesce(o.country, f.country) +from ${stats_db_name}.result_organization ro +left outer join ${stats_db_name}.organization o on o.id=ro.organization +left outer join ${stats_db_name}.result_projects rp on rp.id=ro.id +left outer join ${stats_db_name}.project p on p.id=rp.project +left outer join ${stats_db_name}.funder f on f.name=p.funder +where coalesce(o.country, f.country) IS NOT NULL;