forked from D-Net/dnet-hadoop
Compare commits
3 Commits
dd4c27f4f3
...
5ae4b4286c
Author | SHA1 | Date |
---|---|---|
Antonis Lempesis | 5ae4b4286c | |
Antonis Lempesis | 316d585c8a | |
Antonis Lempesis | 2e4cab026c |
|
@ -56,7 +56,7 @@ join ${stats_db_name}.result res on res.id=r.id;
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_apc purge;
|
||||
|
||||
create table if not exists ${stats_db_name}.result_apc STORED AS PARQUET as
|
||||
select r.id, r.amount, r.currency
|
||||
select distinct r.id, r.amount, r.currency
|
||||
from (
|
||||
select substr(r.id, 4) as id, cast(inst.processingchargeamount.value as float) as amount, inst.processingchargecurrency.value as currency
|
||||
from ${openaire_db_name}.result r lateral view explode(r.instance) instances as inst) r
|
||||
|
|
|
@ -1196,9 +1196,7 @@ select distinct ro.id, 1 as publicly_funded from ${stats_db_name}.result_organiz
|
|||
join ${stats_db_name}.organization o on o.id=ro.organization
|
||||
join publicly_funded_orgs pfo on o.name=pfo.name) tmp on p.id=tmp.id; /*EOS*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
drop table if exists ${stats_db_name}.indi_pub_green_with_license purge; /*EOS*/
|
||||
|
||||
create table ${stats_db_name}.indi_pub_green_with_license stored as parquet as
|
||||
select distinct p.id, coalesce(green_with_license, 0) as green_with_license
|
||||
from ${stats_db_name}.publication p
|
||||
|
@ -1212,6 +1210,43 @@ on p.id= tmp.id; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.result_country purge; /*EOS*/
|
||||
|
||||
create table ${stats_db_name}.result_country stored as parquet as
|
||||
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;
|
||||
|
||||
drop table if exists ${stats_db_name}.indi_result_oa_with_license purge; /*EOS*/
|
||||
create table ${stats_db_name}.indi_result_oa_with_license stored as parquet as
|
||||
select distinct r.id, coalesce(oa_with_license,0) as oa_with_license
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (select distinct r.id, 1 as oa_with_license from ${stats_db_name}.result r
|
||||
join ${stats_db_name}.result_licenses rl on rl.id=r.id where r.bestlicence='Open Access') tmp on r.id=tmp.id; /*EOS*/
|
||||
|
||||
drop table if exists ${stats_db_name}.indi_result_oa_without_license purge; /*EOS*/
|
||||
create table ${stats_db_name}.indi_result_oa_without_license stored as parquet as
|
||||
with without_license as
|
||||
(select distinct id from ${stats_db_name}.indi_result_oa_with_license
|
||||
where oa_with_license=0)
|
||||
select distinct r.id, coalesce(oa_without_license,0) as oa_without_license
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (select distinct r.id, 1 as oa_without_license
|
||||
from ${stats_db_name}.result r
|
||||
join without_license wl on wl.id=r.id
|
||||
where r.bestlicence='Open Access') tmp on r.id=tmp.id; /*EOS*/
|
||||
|
||||
drop table if exists ${stats_db_name}.indi_result_under_transformative purge; /*EOS*/
|
||||
create table ${stats_db_name}.indi_result_under_transformative stored as parquet as
|
||||
with transformative_dois as
|
||||
(select distinct doi from stats_ext.transformative_facts)
|
||||
select distinct r.id, coalesce(under_transformative,0) as under_transformative
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (select distinct rp.id, 1 as under_transformative
|
||||
from ${stats_db_name}.result_pids rp join ${stats_db_name}.result r on r.id=rp.id
|
||||
join transformative_dois td on td.doi=rp.pid) tmp on r.id=tmp.id; /*EOS*/
|
||||
|
||||
select distinct ro.id, coalesce(o.country, f.country) as country
|
||||
from ${stats_db_name}.result_organization ro
|
||||
left outer join ${stats_db_name}.organization o on o.id=ro.organization
|
||||
|
|
Loading…
Reference in New Issue