Improve performance of transferring the stats-DBs to another cluster and querying the DBs' tables, by ordering Spark to create up to 100 files per table, instead of thousands.
This commit is contained in:
parent
7b7dd32ad5
commit
ce0aee21cc
|
@ -10,7 +10,7 @@ set mapred.job.queue.name=analytics; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.publication_sources purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.publication_sources STORED AS PARQUET as
|
||||
SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
SELECT /*+ COALESCE(100) */ p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
FROM (
|
||||
SELECT substr(p.id, 4) as id, substr(datasource, 4) as datasource
|
||||
from ${openaire_db_name}.publication p lateral view explode(p.collectedfrom.key) c as datasource) p
|
||||
|
@ -23,7 +23,7 @@ LEFT OUTER JOIN
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.dataset_sources purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.dataset_sources STORED AS PARQUET as
|
||||
SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
SELECT /*+ COALESCE(100) */ p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
FROM (
|
||||
SELECT substr(p.id, 4) as id, substr(datasource, 4) as datasource
|
||||
from ${openaire_db_name}.dataset p lateral view explode(p.collectedfrom.key) c as datasource) p
|
||||
|
@ -36,7 +36,7 @@ LEFT OUTER JOIN
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.software_sources purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.software_sources STORED AS PARQUET as
|
||||
SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
SELECT /*+ COALESCE(100) */ p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
FROM (
|
||||
SELECT substr(p.id, 4) as id, substr(datasource, 4) as datasource
|
||||
from ${openaire_db_name}.software p lateral view explode(p.collectedfrom.key) c as datasource) p
|
||||
|
@ -49,7 +49,7 @@ LEFT OUTER JOIN
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.otherresearchproduct_sources purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.otherresearchproduct_sources STORED AS PARQUET as
|
||||
SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
SELECT /*+ COALESCE(100) */ p.id, case when d.id is null then 'other' else p.datasource end as datasource
|
||||
FROM (
|
||||
SELECT substr(p.id, 4) as id, substr(datasource, 4) as datasource
|
||||
from ${openaire_db_name}.otherresearchproduct p lateral view explode(p.collectedfrom.key) c as datasource) p
|
||||
|
@ -71,7 +71,7 @@ SELECT * FROM ${stats_db_name}.otherresearchproduct_sources; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_orcid purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.result_orcid STORED AS PARQUET as
|
||||
select distinct res.id, upper(regexp_replace(res.orcid, 'http://orcid.org/' ,'')) as orcid
|
||||
select /*+ COALESCE(100) */ distinct res.id, upper(regexp_replace(res.orcid, 'http://orcid.org/' ,'')) as orcid
|
||||
from (
|
||||
SELECT substr(res.id, 4) as id, auth_pid.value as orcid
|
||||
FROM ${openaire_db_name}.result res
|
||||
|
@ -83,7 +83,7 @@ from (
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_result purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.result_result stored as parquet as
|
||||
select substr(rel.source, 4) as source, substr(rel.target, 4) as target, relclass, subreltype
|
||||
select /*+ COALESCE(100) */ substr(rel.source, 4) as source, substr(rel.target, 4) as target, relclass, subreltype
|
||||
from ${openaire_db_name}.relation rel
|
||||
join ${openaire_db_name}.result r1 on rel.source=r1.id
|
||||
join ${openaire_db_name}.result r2 on r2.id=rel.target
|
||||
|
@ -98,7 +98,7 @@ where reltype='resultResult'
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_citations_oc purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.result_citations_oc stored as parquet as
|
||||
select substr(target, 4) as id, count(distinct substr(source, 4)) as citations
|
||||
select /*+ COALESCE(100) */ substr(target, 4) as id, count(distinct substr(source, 4)) as citations
|
||||
from ${openaire_db_name}.relation rel
|
||||
join ${openaire_db_name}.result r1 on rel.source=r1.id
|
||||
join ${openaire_db_name}.result r2 on r2.id=rel.target
|
||||
|
@ -115,7 +115,7 @@ group by substr(target, 4); /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_references_oc purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.result_references_oc stored as parquet as
|
||||
select substr(source, 4) as id, count(distinct substr(target, 4)) as references
|
||||
select /*+ COALESCE(100) */ substr(source, 4) as id, count(distinct substr(target, 4)) as references
|
||||
from ${openaire_db_name}.relation rel
|
||||
join ${openaire_db_name}.result r1 on rel.source=r1.id
|
||||
join ${openaire_db_name}.result r2 on r2.id=rel.target
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
set mapred.job.queue.name=analytics; /*EOS*/
|
||||
|
||||
------------------------------------------------------
|
||||
------------------------------------------------------
|
||||
-- Additional relations
|
||||
|
@ -9,28 +10,28 @@ set mapred.job.queue.name=analytics; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.publication_licenses purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.publication_licenses STORED AS PARQUET AS
|
||||
SELECT substr(p.id, 4) as id, licenses.value as type
|
||||
SELECT /*+ COALESCE(100) */ substr(p.id, 4) as id, licenses.value as type
|
||||
from ${openaire_db_name}.publication p LATERAL VIEW explode(p.instance.license) instances as licenses
|
||||
where licenses.value is not null and licenses.value != '' and p.datainfo.deletedbyinference=false and p.datainfo.invisible = FALSE; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.dataset_licenses purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.dataset_licenses STORED AS PARQUET AS
|
||||
SELECT substr(p.id, 4) as id, licenses.value as type
|
||||
SELECT /*+ COALESCE(100) */ substr(p.id, 4) as id, licenses.value as type
|
||||
from ${openaire_db_name}.dataset p LATERAL VIEW explode(p.instance.license) instances as licenses
|
||||
where licenses.value is not null and licenses.value != '' and p.datainfo.deletedbyinference=false and p.datainfo.invisible = FALSE; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.software_licenses purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.software_licenses STORED AS PARQUET AS
|
||||
SELECT substr(p.id, 4) as id, licenses.value as type
|
||||
SELECT /*+ COALESCE(100) */ substr(p.id, 4) as id, licenses.value as type
|
||||
from ${openaire_db_name}.software p LATERAL VIEW explode(p.instance.license) instances as licenses
|
||||
where licenses.value is not null and licenses.value != '' and p.datainfo.deletedbyinference=false and p.datainfo.invisible = FALSE; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.otherresearchproduct_licenses purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.otherresearchproduct_licenses STORED AS PARQUET AS
|
||||
SELECT substr(p.id, 4) as id, licenses.value as type
|
||||
SELECT /*+ COALESCE(100) */ substr(p.id, 4) as id, licenses.value as type
|
||||
from ${openaire_db_name}.otherresearchproduct p LATERAL VIEW explode(p.instance.license) instances as licenses
|
||||
where licenses.value is not null and licenses.value != '' and p.datainfo.deletedbyinference=false and p.datainfo.invisible = FALSE; /*EOS*/
|
||||
|
||||
|
@ -46,15 +47,15 @@ SELECT * FROM ${stats_db_name}.otherresearchproduct_licenses; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.organization_pids purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.organization_pids STORED AS PARQUET AS
|
||||
select substr(o.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid
|
||||
select /*+ COALESCE(100) */ substr(o.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid
|
||||
from ${openaire_db_name}.organization o lateral view explode(o.pid) pids as ppid; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.organization_sources purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.organization_sources STORED AS PARQUET as
|
||||
SELECT o.id, case when d.id is null then 'other' else o.datasource end as datasource
|
||||
SELECT /*+ COALESCE(100) */ o.id, case when d.id is null then 'other' else o.datasource end as datasource
|
||||
FROM (
|
||||
SELECT substr(o.id, 4) as id, substr(instances.instance.key, 4) as datasource
|
||||
SELECT substr(o.id, 4) as id, substr(instances.instance.key, 4) as datasource
|
||||
from ${openaire_db_name}.organization o lateral view explode(o.collectedfrom) instances as instance) o
|
||||
LEFT OUTER JOIN (
|
||||
SELECT substr(d.id, 4) id
|
||||
|
@ -64,6 +65,6 @@ FROM (
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_accessroute purge; /*EOS*/
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ${stats_db_name}.result_accessroute STORED AS PARQUET as
|
||||
select distinct substr(id,4) as id, accessroute from ${openaire_db_name}.result
|
||||
select /*+ COALESCE(100) */ distinct substr(id,4) as id, accessroute from ${openaire_db_name}.result
|
||||
lateral view explode (instance.accessright.openaccessroute) openaccessroute as accessroute
|
||||
WHERE datainfo.deletedbyinference=false and datainfo.invisible = FALSE; /*EOS*/
|
||||
|
|
|
@ -18,7 +18,7 @@ non_peer_reviewed as (
|
|||
select distinct substr(r.id, 4) as id, inst.refereed.classname as refereed
|
||||
from ${openaire_db_name}.publication r lateral view explode(r.instance) instances as inst
|
||||
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE and inst.refereed.classname='nonPeerReviewed')
|
||||
select distinct *
|
||||
select /*+ COALESCE(100) */ distinct *
|
||||
from (
|
||||
select peer_reviewed.* from peer_reviewed
|
||||
union all
|
||||
|
@ -36,7 +36,7 @@ non_peer_reviewed as (
|
|||
select distinct substr(r.id, 4) as id, inst.refereed.classname as refereed
|
||||
from ${openaire_db_name}.dataset r lateral view explode(r.instance) instances as inst
|
||||
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE and inst.refereed.classname='nonPeerReviewed')
|
||||
select distinct *
|
||||
select /*+ COALESCE(100) */ distinct *
|
||||
from (
|
||||
select peer_reviewed.* from peer_reviewed
|
||||
union all
|
||||
|
@ -54,7 +54,7 @@ non_peer_reviewed as (
|
|||
select distinct substr(r.id, 4) as id, inst.refereed.classname as refereed
|
||||
from ${openaire_db_name}.software r lateral view explode(r.instance) instances as inst
|
||||
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE and inst.refereed.classname='nonPeerReviewed')
|
||||
select distinct *
|
||||
select /*+ COALESCE(100) */ distinct *
|
||||
from (
|
||||
select peer_reviewed.* from peer_reviewed
|
||||
union all
|
||||
|
@ -72,7 +72,7 @@ non_peer_reviewed as (
|
|||
select distinct substr(r.id, 4) as id, inst.refereed.classname as refereed
|
||||
from ${openaire_db_name}.otherresearchproduct r lateral view explode(r.instance) instances as inst
|
||||
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE and inst.refereed.classname='nonPeerReviewed')
|
||||
select distinct *
|
||||
select /*+ COALESCE(100) */ distinct *
|
||||
from (
|
||||
select peer_reviewed.* from peer_reviewed
|
||||
union all
|
||||
|
@ -92,7 +92,7 @@ select * from ${stats_db_name}.otherresearchproduct_refereed; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.indi_impact_measures purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_impact_measures STORED AS PARQUET as
|
||||
select substr(id, 4) as id, measures_ids.id impactmetric, cast(measures_ids.unit.value[0] as double) score,
|
||||
select /*+ COALESCE(100) */ substr(id, 4) as id, measures_ids.id impactmetric, cast(measures_ids.unit.value[0] as double) score,
|
||||
cast(measures_ids.unit.value[0] as decimal(6,3)) score_dec, measures_ids.unit.value[1] impact_class
|
||||
from ${openaire_db_name}.result lateral view explode(measures) measures as measures_ids
|
||||
where measures_ids.id!='views' and measures_ids.id!='downloads'; /*EOS*/
|
||||
|
@ -100,7 +100,7 @@ where measures_ids.id!='views' and measures_ids.id!='downloads'; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_apc_affiliations purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.result_apc_affiliations STORED AS PARQUET as
|
||||
select distinct substr(rel.target,4) id, substr(rel.source,4) organization, o.legalname.value name,
|
||||
select /*+ COALESCE(100) */ distinct substr(rel.target,4) id, substr(rel.source,4) organization, o.legalname.value name,
|
||||
cast(rel.properties[0].value as double) apc_amount,
|
||||
rel.properties[1].value apc_currency
|
||||
from ${openaire_db_name}.relation rel
|
||||
|
|
|
@ -6,7 +6,7 @@ set mapred.job.queue.name=analytics; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_projectcount purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.result_projectcount STORED AS PARQUET as
|
||||
select r.id, count(distinct p.id) as count
|
||||
select /*+ COALESCE(100) */ r.id, count(distinct p.id) as count
|
||||
from ${stats_db_name}.result r
|
||||
left outer join ${stats_db_name}.result_projects rp on rp.id=r.id
|
||||
left outer join ${stats_db_name}.project p on p.id=rp.project
|
||||
|
@ -15,7 +15,7 @@ group by r.id; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_fundercount purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.result_fundercount STORED AS PARQUET as
|
||||
select r.id, count(distinct p.funder) as count
|
||||
select /*+ COALESCE(100) */ r.id, count(distinct p.funder) as count
|
||||
from ${stats_db_name}.result r
|
||||
left outer join ${stats_db_name}.result_projects rp on rp.id=r.id
|
||||
left outer join ${stats_db_name}.project p on p.id=rp.project
|
||||
|
@ -30,7 +30,7 @@ with rcount as (
|
|||
left outer join ${stats_db_name}.result_projects rp on rp.project=p.id
|
||||
left outer join ${stats_db_name}.result r on r.id=rp.id
|
||||
group by r.type, p.id )
|
||||
select rcount.pid, sum(case when rcount.type='publication' then rcount.count else 0 end) as publications,
|
||||
select /*+ COALESCE(100) */ rcount.pid, sum(case when rcount.type='publication' then rcount.count else 0 end) as publications,
|
||||
sum(case when rcount.type='dataset' then rcount.count else 0 end) as datasets,
|
||||
sum(case when rcount.type='software' then rcount.count else 0 end) as software,
|
||||
sum(case when rcount.type='other' then rcount.count else 0 end) as other
|
||||
|
@ -48,7 +48,7 @@ create or replace view ${stats_db_name}.graduatedoctorates as select * from stat
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_instance purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.result_instance stored as parquet as
|
||||
select distinct r.*
|
||||
select /*+ COALESCE(100) */ distinct r.*
|
||||
from (
|
||||
select substr(r.id, 4) as id, inst.accessright.classname as accessright, inst.accessright.openaccessroute as accessright_uw, substr(inst.collectedfrom.key, 4) as collectedfrom,
|
||||
substr(inst.hostedby.key, 4) as hostedby, inst.dateofacceptance.value as dateofacceptance, inst.license.value as license, p.qualifier.classname as pidtype, p.value as pid
|
||||
|
@ -58,7 +58,7 @@ join ${stats_db_name}.result res on res.id=r.id; /*EOS*/
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.result_apc purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.result_apc STORED AS PARQUET as
|
||||
select distinct r.id, r.amount, r.currency
|
||||
select /*+ COALESCE(100) */ 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- Sprint 1 ----
|
||||
drop table if exists ${stats_db_name}.indi_pub_green_oa purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_green_oa stored as parquet as
|
||||
select distinct p.id, coalesce(green_oa, 0) as green_oa
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(green_oa, 0) as green_oa
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select p.id, 1 as green_oa
|
||||
|
@ -12,7 +12,7 @@ left outer join (
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_grey_lit purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_grey_lit stored as parquet as
|
||||
select distinct p.id, coalesce(grey_lit, 0) as grey_lit
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(grey_lit, 0) as grey_lit
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select p.id, 1 as grey_lit
|
||||
|
@ -23,7 +23,7 @@ left outer join (
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_doi_from_crossref purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_doi_from_crossref stored as parquet as
|
||||
select distinct p.id, coalesce(doi_from_crossref, 0) as doi_from_crossref
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(doi_from_crossref, 0) as doi_from_crossref
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select ri.id, 1 as doi_from_crossref from ${stats_db_name}.result_instance ri
|
||||
|
@ -33,7 +33,7 @@ left outer join (
|
|||
-- Sprint 2 ----
|
||||
drop table if exists ${stats_db_name}.indi_result_has_cc_licence purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_result_has_cc_licence stored as parquet as
|
||||
select distinct r.id, (case when lic='' or lic is null then 0 else 1 end) as has_cc_license
|
||||
select /*+ COALESCE(100) */ distinct r.id, (case when lic='' or lic is null then 0 else 1 end) as has_cc_license
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (
|
||||
select r.id, license.type as lic from ${stats_db_name}.result r
|
||||
|
@ -42,7 +42,7 @@ left outer join (
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_result_has_cc_licence_url purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_result_has_cc_licence_url stored as parquet as
|
||||
select distinct r.id, case when lic_host='' or lic_host is null then 0 else 1 end as has_cc_license_url
|
||||
select /*+ COALESCE(100) */ distinct r.id, case when lic_host='' or lic_host is null then 0 else 1 end as has_cc_license_url
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (
|
||||
select r.id, lower(parse_url(license.type, "HOST")) as lic_host
|
||||
|
@ -52,12 +52,12 @@ left outer join (
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_has_abstract purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_has_abstract stored as parquet as
|
||||
select distinct publication.id, cast(coalesce(abstract, true) as int) has_abstract
|
||||
select /*+ COALESCE(100) */ distinct publication.id, cast(coalesce(abstract, true) as int) has_abstract
|
||||
from ${stats_db_name}.publication; /*EOS*/
|
||||
|
||||
drop table if exists ${stats_db_name}.indi_result_with_orcid purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_result_with_orcid stored as parquet as
|
||||
select distinct r.id, coalesce(has_orcid, 0) as has_orcid
|
||||
select /*+ COALESCE(100) */ distinct r.id, coalesce(has_orcid, 0) as has_orcid
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (
|
||||
select id, 1 as has_orcid from ${stats_db_name}.result_orcid) tmp on r.id= tmp.id; /*EOS*/
|
||||
|
@ -66,7 +66,7 @@ left outer join (
|
|||
---- Sprint 3 ----
|
||||
drop table if exists ${stats_db_name}.indi_funded_result_with_fundref purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_funded_result_with_fundref stored as parquet as
|
||||
select distinct r.result as id, coalesce(fundref, 0) as fundref
|
||||
select /*+ COALESCE(100) */ distinct r.result as id, coalesce(fundref, 0) as fundref
|
||||
from ${stats_db_name}.project_results r
|
||||
left outer join (
|
||||
select distinct result, 1 as fundref from ${stats_db_name}.project_results where provenance='Harvested') tmp on r.result= tmp.result; /*EOS*/
|
||||
|
@ -77,7 +77,7 @@ create table if not exists ${stats_db_name}.indi_result_org_collab stored as par
|
|||
SELECT ro.organization organization, ro.id, o.name
|
||||
from ${stats_db_name}.result_organization ro
|
||||
join ${stats_db_name}.organization o on o.id=ro.organization where o.name is not null)
|
||||
select o1.organization org1, o1.name org1name1, o2.organization org2, o2.name org2name2, count(o1.id) as collaborations
|
||||
select /*+ COALESCE(100) */ o1.organization org1, o1.name org1name1, o2.organization org2, o2.name org2name2, count(o1.id) as collaborations
|
||||
from tmp as o1
|
||||
join tmp as o2 where o1.id=o2.id and o1.organization!=o2.organization and o1.name!=o2.name
|
||||
group by o1.organization, o2.organization, o1.name, o2.name; /*EOS*/
|
||||
|
@ -89,7 +89,7 @@ create table if not exists ${stats_db_name}.indi_result_org_country_collab store
|
|||
from ${stats_db_name}.result_organization ro
|
||||
join ${stats_db_name}.organization o on o.id=ro.organization
|
||||
where country <> 'UNKNOWN' and o.name is not null)
|
||||
select o1.organization org1,o1.name org1name1, o2.country country2, count(o1.id) as collaborations
|
||||
select /*+ COALESCE(100) */ o1.organization org1,o1.name org1name1, o2.country country2, count(o1.id) as collaborations
|
||||
from tmp as o1 join tmp as o2 on o1.id=o2.id
|
||||
where o1.id=o2.id and o1.country!=o2.country
|
||||
group by o1.organization, o1.id, o1.name, o2.country; /*EOS*/
|
||||
|
@ -100,7 +100,7 @@ create table if not exists ${stats_db_name}.indi_project_collab_org stored as pa
|
|||
select o.id organization, o.name, ro.project as project
|
||||
from ${stats_db_name}.organization o
|
||||
join ${stats_db_name}.organization_projects ro on o.id=ro.id where o.name is not null)
|
||||
select o1.organization org1,o1.name orgname1, o2.organization org2, o2.name orgname2, count(distinct o1.project) as collaborations
|
||||
select /*+ COALESCE(100) */ o1.organization org1,o1.name orgname1, o2.organization org2, o2.name orgname2, count(distinct o1.project) as collaborations
|
||||
from tmp as o1
|
||||
join tmp as o2 on o1.project=o2.project
|
||||
where o1.organization<>o2.organization and o1.name<>o2.name
|
||||
|
@ -112,7 +112,7 @@ create table if not exists ${stats_db_name}.indi_project_collab_org_country stor
|
|||
select o.id organization, o.name, o.country , ro.project as project
|
||||
from ${stats_db_name}.organization o
|
||||
join ${stats_db_name}.organization_projects ro on o.id=ro.id and o.country <> 'UNKNOWN' and o.name is not null)
|
||||
select o1.organization org1,o1.name org1name, o2.country country2, count(distinct o1.project) as collaborations
|
||||
select /*+ COALESCE(100) */ o1.organization org1,o1.name org1name, o2.country country2, count(distinct o1.project) as collaborations
|
||||
from tmp as o1
|
||||
join tmp as o2 on o1.project=o2.project
|
||||
where o1.organization<>o2.organization and o1.country<>o2.country
|
||||
|
@ -124,7 +124,7 @@ create table if not exists ${stats_db_name}.indi_funder_country_collab stored as
|
|||
join ${stats_db_name}.organization o on o.id=op.id
|
||||
join ${stats_db_name}.project p on p.id=op.project
|
||||
where country <> 'UNKNOWN')
|
||||
select f1.funder, f1.country as country1, f2.country as country2, count(distinct f1.project) as collaborations
|
||||
select /*+ COALESCE(100) */ f1.funder, f1.country as country1, f2.country as country2, count(distinct f1.project) as collaborations
|
||||
from tmp as f1
|
||||
join tmp as f2 on f1.project=f2.project
|
||||
where f1.country<>f2.country
|
||||
|
@ -136,7 +136,7 @@ create table if not exists ${stats_db_name}.indi_result_country_collab stored as
|
|||
select distinct country, ro.id as result from ${stats_db_name}.organization o
|
||||
join ${stats_db_name}.result_organization ro on o.id=ro.organization
|
||||
where country <> 'UNKNOWN' and o.name is not null)
|
||||
select o1.country country1, o2.country country2, count(o1.result) as collaborations
|
||||
select /*+ COALESCE(100) */ o1.country country1, o2.country country2, count(o1.result) as collaborations
|
||||
from tmp as o1
|
||||
join tmp as o2 on o1.result=o2.result
|
||||
where o1.country<>o2.country
|
||||
|
@ -146,7 +146,7 @@ create table if not exists ${stats_db_name}.indi_result_country_collab stored as
|
|||
---- Sprint 4 ----
|
||||
drop table if exists ${stats_db_name}.indi_pub_diamond purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_diamond stored as parquet as
|
||||
select distinct pd.id, coalesce(in_diamond_journal, 0) as in_diamond_journal
|
||||
select /*+ COALESCE(100) */ distinct pd.id, coalesce(in_diamond_journal, 0) as in_diamond_journal
|
||||
from ${stats_db_name}.publication_datasources pd
|
||||
left outer join (
|
||||
select pd.id, 1 as in_diamond_journal
|
||||
|
@ -157,7 +157,7 @@ create table if not exists ${stats_db_name}.indi_pub_diamond stored as parquet a
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_in_transformative purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_in_transformative stored as parquet as
|
||||
select distinct pd.id, coalesce(is_transformative, 0) as is_transformative
|
||||
select /*+ COALESCE(100) */ distinct pd.id, coalesce(is_transformative, 0) as is_transformative
|
||||
from ${stats_db_name}.publication pd
|
||||
left outer join (
|
||||
select pd.id, 1 as is_transformative
|
||||
|
@ -168,7 +168,7 @@ create table if not exists ${stats_db_name}.indi_pub_in_transformative stored as
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_closed_other_open purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_closed_other_open stored as parquet as
|
||||
select distinct ri.id, coalesce(pub_closed_other_open, 0) as pub_closed_other_open
|
||||
select /*+ COALESCE(100) */ distinct ri.id, coalesce(pub_closed_other_open, 0) as pub_closed_other_open
|
||||
from ${stats_db_name}.result_instance ri
|
||||
left outer join (
|
||||
select ri.id, 1 as pub_closed_other_open
|
||||
|
@ -182,14 +182,14 @@ create table if not exists ${stats_db_name}.indi_pub_closed_other_open stored as
|
|||
---- Sprint 5 ----
|
||||
drop table if exists ${stats_db_name}.indi_result_no_of_copies purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_result_no_of_copies stored as parquet as
|
||||
select id, count(id) as number_of_copies
|
||||
select /*+ COALESCE(100) */ id, count(id) as number_of_copies
|
||||
from ${stats_db_name}.result_instance
|
||||
group by id; /*EOS*/
|
||||
|
||||
---- Sprint 6 ----
|
||||
drop table if exists ${stats_db_name}.indi_pub_downloads purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_downloads stored as parquet as
|
||||
SELECT result_id, sum(downloads) no_downloads
|
||||
SELECT /*+ COALESCE(100) */ result_id, sum(downloads) no_downloads
|
||||
from openaire_prod_usage_stats.usage_stats
|
||||
join ${stats_db_name}.publication on result_id=id
|
||||
where downloads>0
|
||||
|
@ -197,7 +197,7 @@ create table if not exists ${stats_db_name}.indi_pub_downloads stored as parquet
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_downloads_datasource purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_downloads_datasource stored as parquet as
|
||||
SELECT result_id, repository_id, sum(downloads) no_downloads
|
||||
SELECT /*+ COALESCE(100) */ result_id, repository_id, sum(downloads) no_downloads
|
||||
from openaire_prod_usage_stats.usage_stats
|
||||
join ${stats_db_name}.publication on result_id=id
|
||||
where downloads>0
|
||||
|
@ -205,14 +205,14 @@ create table if not exists ${stats_db_name}.indi_pub_downloads_datasource stored
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_downloads_year purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_downloads_year stored as parquet as
|
||||
SELECT result_id, cast(substring(us.`date`, 1,4) as int) as `year`, sum(downloads) no_downloads
|
||||
SELECT /*+ COALESCE(100) */ result_id, cast(substring(us.`date`, 1,4) as int) as `year`, sum(downloads) no_downloads
|
||||
from openaire_prod_usage_stats.usage_stats us
|
||||
join ${stats_db_name}.publication on result_id=id where downloads>0
|
||||
GROUP BY result_id, substring(us.`date`, 1,4); /*EOS*/
|
||||
|
||||
drop table if exists ${stats_db_name}.indi_pub_downloads_datasource_year purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_downloads_datasource_year stored as parquet as
|
||||
SELECT result_id, cast(substring(us.`date`, 1,4) as int) as `year`, repository_id, sum(downloads) no_downloads
|
||||
SELECT /*+ COALESCE(100) */ result_id, cast(substring(us.`date`, 1,4) as int) as `year`, repository_id, sum(downloads) no_downloads
|
||||
from openaire_prod_usage_stats.usage_stats us
|
||||
join ${stats_db_name}.publication on result_id=id
|
||||
where downloads>0
|
||||
|
@ -241,7 +241,7 @@ create table if not exists ${stats_db_name}.indi_pub_gold_oa stored as parquet a
|
|||
UNION ALL
|
||||
select id, issn_online as issn from ${stats_db_name}.datasource d left semi join gold_oa on gold_oa.issn=d.issn_online) foo
|
||||
)
|
||||
SELECT DISTINCT pd.id, coalesce(is_gold, 0) as is_gold
|
||||
SELECT /*+ COALESCE(100) */ DISTINCT pd.id, coalesce(is_gold, 0) as is_gold
|
||||
FROM ${stats_db_name}.publication pd
|
||||
left outer join (
|
||||
select pd.id, 1 as is_gold
|
||||
|
@ -272,7 +272,7 @@ create table if not exists ${stats_db_name}.indi_pub_hybrid_oa_with_cc stored as
|
|||
FROM ${stats_db_name}.datasource
|
||||
WHERE issn_online IS NOT NULL ) as issn
|
||||
WHERE LENGTH(issn) > 7)
|
||||
SELECT DISTINCT pd.id, coalesce(is_hybrid_oa, 0) as is_hybrid_oa
|
||||
SELECT /*+ COALESCE(100) */ DISTINCT pd.id, coalesce(is_hybrid_oa, 0) as is_hybrid_oa
|
||||
FROM ${stats_db_name}.publication_datasources pd
|
||||
LEFT OUTER JOIN (
|
||||
SELECT pd.id, 1 as is_hybrid_oa from ${stats_db_name}.publication_datasources pd
|
||||
|
@ -284,7 +284,7 @@ create table if not exists ${stats_db_name}.indi_pub_hybrid_oa_with_cc stored as
|
|||
|
||||
drop table if exists ${stats_db_name}.indi_pub_hybrid purge; /*EOS*/
|
||||
create table if not exists ${stats_db_name}.indi_pub_hybrid stored as parquet as
|
||||
select distinct p.id, coalesce(is_hybrid, 0) is_hybrid
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(is_hybrid, 0) is_hybrid
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select p.id, 1 as is_hybrid
|
||||
|
@ -313,7 +313,7 @@ create table if not exists ${stats_db_name}.indi_org_fairness stored as parquet
|
|||
where cast(year as int)>2003
|
||||
group by ro.organization)
|
||||
--return results_fair/all_results
|
||||
select allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
select /*+ COALESCE(100) */ allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
from allresults
|
||||
join result_fair on result_fair.organization=allresults.organization; /*EOS*/
|
||||
|
||||
|
@ -336,7 +336,7 @@ select ro.organization, count(distinct ro.id) no_allresults from ${stats_db_name
|
|||
drop table if exists ${stats_db_name}.indi_org_fairness_pub_pr purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_fairness_pub_pr stored as parquet as
|
||||
select ar.organization, rf.no_result_fair/ar.no_allresults org_fairness
|
||||
select /*+ COALESCE(100) */ ar.organization, rf.no_result_fair/ar.no_allresults org_fairness
|
||||
from allresults ar
|
||||
join result_fair rf on rf.organization=ar.organization; /*EOS*/
|
||||
|
||||
|
@ -357,7 +357,7 @@ CREATE TEMPORARY VIEW allresults as select year, ro.organization, count(distinct
|
|||
drop table if exists ${stats_db_name}.indi_org_fairness_pub_year purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_fairness_pub_year stored as parquet as
|
||||
select cast(allresults.year as int) year, allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
select /*+ COALESCE(100) */ cast(allresults.year as int) year, allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
from allresults
|
||||
join result_fair on result_fair.organization=allresults.organization and result_fair.year=allresults.year; /*EOS*/
|
||||
|
||||
|
@ -381,7 +381,7 @@ CREATE TEMPORARY VIEW allresults as
|
|||
drop table if exists ${stats_db_name}.indi_org_fairness_pub purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_fairness_pub stored as parquet as
|
||||
select ar.organization, rf.no_result_fair/ar.no_allresults org_fairness
|
||||
select /*+ COALESCE(100) */ ar.organization, rf.no_result_fair/ar.no_allresults org_fairness
|
||||
from allresults ar join result_fair rf
|
||||
on rf.organization=ar.organization; /*EOS*/
|
||||
|
||||
|
@ -404,7 +404,7 @@ CREATE TEMPORARY VIEW allresults as
|
|||
drop table if exists ${stats_db_name}.indi_org_fairness_year purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_fairness_year stored as parquet as
|
||||
select cast(allresults.year as int) year, allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
select /*+ COALESCE(100) */ cast(allresults.year as int) year, allresults.organization, result_fair.no_result_fair/allresults.no_allresults org_fairness
|
||||
from allresults
|
||||
join result_fair on result_fair.organization=allresults.organization and cast(result_fair.year as int)=cast(allresults.year as int); /*EOS*/
|
||||
|
||||
|
@ -427,7 +427,7 @@ CREATE TEMPORARY VIEW allresults as
|
|||
drop table if exists ${stats_db_name}.indi_org_findable_year purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_findable_year stored as parquet as
|
||||
select cast(allresults.year as int) year, allresults.organization, result_with_pid.no_result_with_pid/allresults.no_allresults org_findable
|
||||
select /*+ COALESCE(100) */ cast(allresults.year as int) year, allresults.organization, result_with_pid.no_result_with_pid/allresults.no_allresults org_findable
|
||||
from allresults
|
||||
join result_with_pid on result_with_pid.organization=allresults.organization and cast(result_with_pid.year as int)=cast(allresults.year as int); /*EOS*/
|
||||
|
||||
|
@ -450,7 +450,7 @@ select ro.organization, count(distinct ro.id) no_allresults from ${stats_db_name
|
|||
drop table if exists ${stats_db_name}.indi_org_findable purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_findable stored as parquet as
|
||||
select allresults.organization, result_with_pid.no_result_with_pid/allresults.no_allresults org_findable
|
||||
select /*+ COALESCE(100) */ allresults.organization, result_with_pid.no_result_with_pid/allresults.no_allresults org_findable
|
||||
from allresults
|
||||
join result_with_pid on result_with_pid.organization=allresults.organization; /*EOS*/
|
||||
|
||||
|
@ -516,7 +516,7 @@ select software_oa.organization, software_oa.no_oasoftware/allsoftware.no_allsof
|
|||
drop table if exists ${stats_db_name}.indi_org_openess purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_openess stored as parquet as
|
||||
select allpubsshare.organization,
|
||||
select /*+ COALESCE(100) */ allpubsshare.organization,
|
||||
(p+if(isnull(s),0,s)+if(isnull(d),0,d))/(1+(case when s is null then 0 else 1 end)
|
||||
+(case when d is null then 0 else 1 end))
|
||||
org_openess FROM allpubsshare
|
||||
|
@ -593,7 +593,7 @@ select allsoftware.year, software_oa.organization, software_oa.no_oasoftware/all
|
|||
drop table if exists ${stats_db_name}.indi_org_openess_year purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_org_openess_year stored as parquet as
|
||||
select cast(allpubsshare.year as int) year, allpubsshare.organization,
|
||||
select /*+ COALESCE(100) */ cast(allpubsshare.year as int) year, allpubsshare.organization,
|
||||
(p+if(isnull(s),0,s)+if(isnull(d),0,d))/(1+(case when s is null then 0 else 1 end)
|
||||
+(case when d is null then 0 else 1 end))
|
||||
org_openess FROM allpubsshare
|
||||
|
@ -617,7 +617,7 @@ DROP VIEW allsoftwaresshare; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.indi_pub_has_preprint purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_pub_has_preprint stored as parquet as
|
||||
select distinct p.id, coalesce(has_preprint, 0) as has_preprint
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(has_preprint, 0) as has_preprint
|
||||
from ${stats_db_name}.publication_classifications p
|
||||
left outer join (
|
||||
select p.id, 1 as has_preprint
|
||||
|
@ -627,7 +627,7 @@ from ${stats_db_name}.publication_classifications p
|
|||
drop table if exists ${stats_db_name}.indi_pub_in_subscribed purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_pub_in_subscribed stored as parquet as
|
||||
select distinct p.id, coalesce(is_subscription, 0) as is_subscription
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(is_subscription, 0) as is_subscription
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join(
|
||||
select p.id, 1 as is_subscription from ${stats_db_name}.publication p
|
||||
|
@ -640,7 +640,7 @@ from ${stats_db_name}.publication p
|
|||
drop table if exists ${stats_db_name}.indi_result_with_pid purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_result_with_pid stored as parquet as
|
||||
select distinct p.id, coalesce(result_with_pid, 0) as result_with_pid
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(result_with_pid, 0) as result_with_pid
|
||||
from ${stats_db_name}.result p
|
||||
left outer join (
|
||||
select p.id, 1 as result_with_pid
|
||||
|
@ -654,7 +654,7 @@ group by rf.id; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.indi_pub_interdisciplinarity purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_pub_interdisciplinarity stored as parquet as
|
||||
select distinct p.id as id, coalesce(is_interdisciplinary, 0)
|
||||
select /*+ COALESCE(100) */ distinct p.id as id, coalesce(is_interdisciplinary, 0)
|
||||
as is_interdisciplinary
|
||||
from pub_fos_totals p
|
||||
left outer join (
|
||||
|
@ -666,7 +666,7 @@ drop view pub_fos_totals; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.indi_pub_bronze_oa purge; /*EOS*/
|
||||
|
||||
create table ${stats_db_name}.indi_pub_bronze_oa stored as parquet as
|
||||
select distinct p.id,coalesce(is_bronze_oa,0) is_bronze_oa
|
||||
select /*+ COALESCE(100) */ distinct p.id,coalesce(is_bronze_oa,0) is_bronze_oa
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select p.id, 1 as is_bronze_oa
|
||||
|
@ -689,7 +689,7 @@ where p.end_year is NOT NULL and r.year is not null; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.indi_is_project_result_after purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_is_project_result_after stored as parquet as
|
||||
select pry.project_id, pry.acronym, pry.result_id,
|
||||
select /*+ COALESCE(100) */ pry.project_id, pry.acronym, pry.result_id,
|
||||
coalesce(is_project_result_after, 0) as is_project_result_after
|
||||
from project_year_result_year pry
|
||||
left outer join (select pry.project_id, pry.acronym, pry.result_id, 1 as is_project_result_after
|
||||
|
@ -701,7 +701,7 @@ drop view project_year_result_year; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.indi_is_funder_plan_s purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_is_funder_plan_s stored as parquet as
|
||||
select distinct f.id, f.name, coalesce(is_funder_plan_s, 0) as is_funder_plan_s
|
||||
select /*+ COALESCE(100) */ distinct f.id, f.name, coalesce(is_funder_plan_s, 0) as is_funder_plan_s
|
||||
from ${stats_db_name}.funder f
|
||||
left outer join (select id, name, 1 as is_funder_plan_s from ${stats_db_name}.funder
|
||||
join stats_ext.plan_s_short on c_o_alition_s_organisation_funder=name) tmp
|
||||
|
@ -722,7 +722,7 @@ create table if not exists ${stats_db_name}.indi_funder_fairness stored as parqu
|
|||
join ${stats_db_name}.project p on p.id=rp.project
|
||||
where cast(year as int)>2003
|
||||
group by p.funder)
|
||||
select allresults.funder, result_fair.no_result_fair/allresults.no_allresults funder_fairness
|
||||
select /*+ COALESCE(100) */ allresults.funder, result_fair.no_result_fair/allresults.no_allresults funder_fairness
|
||||
from allresults
|
||||
join result_fair on result_fair.funder=allresults.funder; /*EOS*/
|
||||
|
||||
|
@ -745,7 +745,7 @@ allresults as
|
|||
join ${stats_db_name}.result r on r.id=rc.id
|
||||
where cast(year as int)>2003
|
||||
group by rc.ri_initiative)
|
||||
select allresults.ri_initiative, result_fair.no_result_fair/allresults.no_allresults ris_fairness
|
||||
select /*+ COALESCE(100) */ allresults.ri_initiative, result_fair.no_result_fair/allresults.no_allresults ris_fairness
|
||||
from allresults
|
||||
join result_fair on result_fair.ri_initiative=allresults.ri_initiative; /*EOS*/
|
||||
|
||||
|
@ -817,16 +817,14 @@ select software_oa.funder, software_oa.no_oasoftware/allsoftware.no_allsoftware
|
|||
drop table if exists ${stats_db_name}.indi_funder_openess purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_funder_openess stored as parquet as
|
||||
select allpubsshare.funder,
|
||||
(p+if(isnull(s),0,s)+if(isnull(d),0,d))/(1+(case when s is null then 0 else 1 end)
|
||||
+(case when d is null then 0 else 1 end))
|
||||
funder_openess FROM allpubsshare
|
||||
left outer join (select funder,d from
|
||||
alldatasetssshare) tmp1
|
||||
on tmp1.funder=allpubsshare.funder
|
||||
left outer join (select funder,s from
|
||||
allsoftwaresshare) tmp2
|
||||
on tmp2.funder=allpubsshare.funder; /*EOS*/
|
||||
select /*+ COALESCE(100) */ allpubsshare.funder,
|
||||
(p+if(isnull(s),0,s)+if(isnull(d),0,d))/(1+(case when s is null then 0 else 1 end)
|
||||
+(case when d is null then 0 else 1 end)) funder_openess
|
||||
FROM allpubsshare
|
||||
left outer join (select funder,d from alldatasetssshare) tmp1
|
||||
on tmp1.funder=allpubsshare.funder
|
||||
left outer join (select funder,s from allsoftwaresshare) tmp2
|
||||
on tmp2.funder=allpubsshare.funder; /*EOS*/
|
||||
|
||||
DROP VIEW pubs_oa; /*EOS*/
|
||||
DROP VIEW datasets_oa; /*EOS*/
|
||||
|
@ -905,7 +903,7 @@ select software_oa.ri_initiative, software_oa.no_oasoftware/allsoftware.no_allso
|
|||
drop table if exists ${stats_db_name}.indi_ris_openess purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.indi_ris_openess stored as parquet as
|
||||
select allpubsshare.ri_initiative,
|
||||
select /*+ COALESCE(100) */ allpubsshare.ri_initiative,
|
||||
(p+if(isnull(s),0,s)+if(isnull(d),0,d))/(1+(case when s is null then 0 else 1 end)
|
||||
+(case when d is null then 0 else 1 end))
|
||||
ris_openess FROM allpubsshare
|
||||
|
@ -943,7 +941,7 @@ with result_findable as
|
|||
join ${stats_db_name}.project p on p.id=rp.project
|
||||
where cast(year as int)>2003
|
||||
group by p.funder)
|
||||
select allresults.funder, result_findable.no_result_findable/allresults.no_allresults funder_findable
|
||||
select /*+ COALESCE(100) */ allresults.funder, result_findable.no_result_findable/allresults.no_allresults funder_findable
|
||||
from allresults
|
||||
join result_findable on result_findable.funder=allresults.funder; /*EOS*/
|
||||
|
||||
|
@ -952,22 +950,22 @@ drop table if exists ${stats_db_name}.indi_ris_findable purge; /*EOS*/
|
|||
|
||||
create table if not exists ${stats_db_name}.indi_ris_findable stored as parquet as
|
||||
with result_contexts as
|
||||
(select distinct rc.id, context.name ri_initiative from ${stats_db_name}.result_concepts rc
|
||||
join ${stats_db_name}.concept on concept.id=rc.concept
|
||||
join ${stats_db_name}.category on category.id=concept.category
|
||||
join ${stats_db_name}.context on context.id=category.context),
|
||||
result_findable as
|
||||
(select rc.ri_initiative ri_initiative, count(distinct rc.id) no_result_findable from result_contexts rc
|
||||
join ${stats_db_name}.result r on r.id=rc.id
|
||||
join ${stats_db_name}.result_pids rp on rp.id=r.id
|
||||
where cast(r.year as int)>2003
|
||||
group by rc.ri_initiative),
|
||||
allresults as
|
||||
(select rc.ri_initiative ri_initiative, count(distinct rc.id) no_allresults from result_contexts rc
|
||||
join ${stats_db_name}.result r on r.id=rc.id
|
||||
where cast(r.year as int)>2003
|
||||
group by rc.ri_initiative)
|
||||
select allresults.ri_initiative, result_findable.no_result_findable/allresults.no_allresults ris_findable
|
||||
(select distinct rc.id, context.name ri_initiative from ${stats_db_name}.result_concepts rc
|
||||
join ${stats_db_name}.concept on concept.id=rc.concept
|
||||
join ${stats_db_name}.category on category.id=concept.category
|
||||
join ${stats_db_name}.context on context.id=category.context),
|
||||
result_findable as
|
||||
(select rc.ri_initiative ri_initiative, count(distinct rc.id) no_result_findable from result_contexts rc
|
||||
join ${stats_db_name}.result r on r.id=rc.id
|
||||
join ${stats_db_name}.result_pids rp on rp.id=r.id
|
||||
where cast(r.year as int)>2003
|
||||
group by rc.ri_initiative),
|
||||
allresults as
|
||||
(select rc.ri_initiative ri_initiative, count(distinct rc.id) no_allresults from result_contexts rc
|
||||
join ${stats_db_name}.result r on r.id=rc.id
|
||||
where cast(r.year as int)>2003
|
||||
group by rc.ri_initiative)
|
||||
select /*+ COALESCE(100) */ allresults.ri_initiative, result_findable.no_result_findable/allresults.no_allresults ris_findable
|
||||
from allresults
|
||||
join result_findable on result_findable.ri_initiative=allresults.ri_initiative; /*EOS*/
|
||||
|
||||
|
@ -975,20 +973,20 @@ drop table if exists ${stats_db_name}.indi_pub_publicly_funded purge; /*EOS*/
|
|||
|
||||
create table if not exists ${stats_db_name}.indi_pub_publicly_funded stored as parquet as
|
||||
with org_names_pids as
|
||||
(select org.id,name, pid from ${stats_db_name}.organization org
|
||||
join ${stats_db_name}.organization_pids op on org.id=op.id),
|
||||
publicly_funded_orgs as
|
||||
(select distinct name from
|
||||
(select pf.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join ${stats_db_name}.fundref f on f.name=pf.name where f.type='government'
|
||||
union all
|
||||
select pf.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join ${stats_db_name}.project p on p.funder=pf.name
|
||||
union all
|
||||
select op.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join org_names_pids op on (op.name=pf.name or op.pid=pf.ror)
|
||||
and pf.publicly_funded='yes') foo)
|
||||
select distinct p.id, coalesce(publicly_funded, 0) as publicly_funded
|
||||
(select org.id,name, pid from ${stats_db_name}.organization org
|
||||
join ${stats_db_name}.organization_pids op on org.id=op.id),
|
||||
publicly_funded_orgs as
|
||||
(select distinct name from
|
||||
(select pf.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join ${stats_db_name}.fundref f on f.name=pf.name where f.type='government'
|
||||
union all
|
||||
select pf.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join ${stats_db_name}.project p on p.funder=pf.name
|
||||
union all
|
||||
select op.name from stats_ext.insitutions_for_publicly_funded pf
|
||||
join org_names_pids op on (op.name=pf.name or op.pid=pf.ror)
|
||||
and pf.publicly_funded='yes') foo)
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(publicly_funded, 0) as publicly_funded
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select distinct ro.id, 1 as publicly_funded from ${stats_db_name}.result_organization ro
|
||||
|
@ -997,7 +995,7 @@ join publicly_funded_orgs pfo on o.name=pfo.name) tmp on p.id=tmp.id; /*EOS*/
|
|||
|
||||
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
|
||||
select /*+ COALESCE(100) */ distinct p.id, coalesce(green_with_license, 0) as green_with_license
|
||||
from ${stats_db_name}.publication p
|
||||
left outer join (
|
||||
select distinct p.id, 1 as green_with_license from ${stats_db_name}.publication p
|
||||
|
@ -1008,7 +1006,7 @@ left outer join (
|
|||
drop table if exists ${stats_db_name}.result_country purge; /*EOS*/
|
||||
|
||||
create table ${stats_db_name}.result_country stored as parquet as
|
||||
select distinct id, country
|
||||
select /*+ COALESCE(100) */ distinct id, country
|
||||
from (
|
||||
select ro.id, o.country
|
||||
from ${stats_db_name}.result_organization ro
|
||||
|
@ -1023,7 +1021,7 @@ where rc.country is not null; /*EOS*/
|
|||
|
||||
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
|
||||
select /*+ COALESCE(100) */ 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*/
|
||||
|
@ -1031,9 +1029,9 @@ join ${stats_db_name}.result_licenses rl on rl.id=r.id where r.bestlicence='Open
|
|||
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
|
||||
(select distinct id from ${stats_db_name}.indi_result_oa_with_license
|
||||
where oa_with_license=0)
|
||||
select /*+ COALESCE(100) */ 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
|
||||
|
@ -1044,7 +1042,7 @@ drop table if exists ${stats_db_name}.indi_result_under_transformative purge; /*
|
|||
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
|
||||
select /*+ COALESCE(100) */ 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
|
||||
|
|
|
@ -8,7 +8,7 @@ set mapred.job.queue.name=analytics; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.result_peerreviewed purge; /*EOS*/
|
||||
|
||||
create table IF NOT EXISTS ${stats_db_name}.result_peerreviewed STORED AS PARQUET as
|
||||
select r.id as id, case when doi.doi_from_crossref=1 and grey.grey_lit=0 then true else false end as peer_reviewed
|
||||
select /*+ COALESCE(100) */ r.id as id, case when doi.doi_from_crossref=1 and grey.grey_lit=0 then true else false end as peer_reviewed
|
||||
from ${stats_db_name}.result r
|
||||
left outer join ${stats_db_name}.indi_pub_doi_from_crossref doi on doi.id=r.id
|
||||
left outer join ${stats_db_name}.indi_pub_grey_lit grey on grey.id=r.id; /*EOS*/
|
||||
|
@ -17,7 +17,7 @@ left outer join ${stats_db_name}.indi_pub_grey_lit grey on grey.id=r.id; /*EOS*/
|
|||
drop table if exists ${stats_db_name}.result_greenoa purge; /*EOS*/
|
||||
|
||||
create table IF NOT EXISTS ${stats_db_name}.result_greenoa STORED AS PARQUET as
|
||||
select r.id, case when green.green_oa=1 then true else false end as green
|
||||
select /*+ COALESCE(100) */ r.id, case when green.green_oa=1 then true else false end as green
|
||||
from ${stats_db_name}.result r
|
||||
left outer join ${stats_db_name}.indi_pub_green_oa green on green.id=r.id; /*EOS*/
|
||||
|
||||
|
@ -25,6 +25,6 @@ left outer join ${stats_db_name}.indi_pub_green_oa green on green.id=r.id; /*EOS
|
|||
drop table if exists ${stats_db_name}.result_gold purge; /*EOS*/
|
||||
|
||||
create table IF NOT EXISTS ${stats_db_name}.result_gold STORED AS PARQUET as
|
||||
select r.id, case when gold.is_gold=1 then true else false end as gold
|
||||
select /*+ COALESCE(100) */ r.id, case when gold.is_gold=1 then true else false end as gold
|
||||
from ${stats_db_name}.result r
|
||||
left outer join ${stats_db_name}.indi_pub_gold_oa gold on gold.id=r.id; /*EOS*/
|
|
@ -1,7 +1,7 @@
|
|||
set mapred.job.queue.name=analytics; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_cc_licence stored as parquet as
|
||||
select r.id, coalesce(rln.count, 0) > 0 as cc_licence
|
||||
select /*+ COALESCE(100) */ r.id, coalesce(rln.count, 0) > 0 as cc_licence
|
||||
from ${stats_db_name}.result r
|
||||
left outer join (
|
||||
select rl.id, sum(case when rl.type like 'CC%' then 1 else 0 end) as count
|
||||
|
@ -11,7 +11,7 @@ from ${stats_db_name}.result r
|
|||
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -41,7 +41,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_year stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -71,7 +71,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_year_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -101,7 +101,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_datasource stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -132,7 +132,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, d.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_datasource_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -163,7 +163,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, d.name, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_organization stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -192,7 +192,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, o.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_organization_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -221,7 +221,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, o.name, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_funder stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -252,7 +252,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, p.funder; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_affiliated_funder_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -283,7 +283,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, p.funder, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -314,7 +314,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_year stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -346,7 +346,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_year_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -377,7 +377,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, r.year, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_datasource stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -408,7 +408,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, d.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_datasource_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -439,7 +439,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, d.name, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_organization stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -470,7 +470,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, o.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_organization_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -501,7 +501,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, o.name, c.code, c.name; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_funder stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
@ -534,7 +534,7 @@ group by r.green, r.gold, case when rl.type is not null then true else false end
|
|||
cc_licence, r.authors > 1, rpc.count > 1, rfc.count > 1, p.funder; /*EOS*/
|
||||
|
||||
create table ${observatory_db_name}.result_deposited_funder_country stored as parquet as
|
||||
select
|
||||
select /*+ COALESCE(100) */
|
||||
count(distinct r.id) as total,
|
||||
r.green,
|
||||
r.gold,
|
||||
|
|
|
@ -39,21 +39,21 @@ where dtrce.datainfo.deletedbyinference = false and dtrce.datainfo.invisible = f
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.datasource_languages purge; /*EOS*/
|
||||
|
||||
CREATE TABLE ${stats_db_name}.datasource_languages STORED AS PARQUET AS
|
||||
SELECT substr(d.id, 4) AS id, langs.languages AS language
|
||||
SELECT /*+ COALESCE(100) */ substr(d.id, 4) AS id, langs.languages AS language
|
||||
FROM ${openaire_db_name}.datasource d LATERAL VIEW explode(d.odlanguages.value) langs AS languages
|
||||
where d.datainfo.deletedbyinference=false and d.datainfo.invisible=false; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.datasource_oids purge; /*EOS*/
|
||||
|
||||
CREATE TABLE ${stats_db_name}.datasource_oids STORED AS PARQUET AS
|
||||
SELECT substr(d.id, 4) AS id, oids.ids AS oid
|
||||
SELECT /*+ COALESCE(100) */ substr(d.id, 4) AS id, oids.ids AS oid
|
||||
FROM ${openaire_db_name}.datasource d LATERAL VIEW explode(d.originalid) oids AS ids
|
||||
where d.datainfo.deletedbyinference=false and d.datainfo.invisible=false; /*EOS*/
|
||||
|
||||
DROP TABLE IF EXISTS ${stats_db_name}.datasource_organizations purge; /*EOS*/
|
||||
|
||||
CREATE TABLE ${stats_db_name}.datasource_organizations STORED AS PARQUET AS
|
||||
SELECT substr(r.target, 4) AS id, substr(r.source, 4) AS organization
|
||||
SELECT /*+ COALESCE(100) */ substr(r.target, 4) AS id, substr(r.source, 4) AS organization
|
||||
FROM ${openaire_db_name}.relation r
|
||||
WHERE r.reltype = 'datasourceOrganization' and r.datainfo.deletedbyinference = false and r.source like '20|%' and r.datainfo.invisible=false; /*EOS*/
|
||||
|
||||
|
@ -62,10 +62,10 @@ WHERE r.reltype = 'datasourceOrganization' and r.datainfo.deletedbyinference = f
|
|||
DROP TABLE IF EXISTS ${stats_db_name}.datasource_sources purge; /*EOS*/
|
||||
|
||||
create table if not exists ${stats_db_name}.datasource_sources STORED AS PARQUET AS
|
||||
select substr(d.id, 4) as id, substr(cf.key, 4) as datasource
|
||||
select /*+ COALESCE(100) */ substr(d.id, 4) as id, substr(cf.key, 4) as datasource
|
||||
from ${openaire_db_name}.datasource d lateral view explode(d.collectedfrom) cfrom as cf
|
||||
where d.datainfo.deletedbyinference = false and d.datainfo.invisible=false; /*EOS*/
|
||||
|
||||
CREATE OR REPLACE VIEW ${stats_db_name}.datasource_results AS
|
||||
SELECT /*+ COALESCE(100) */ datasource AS id, id AS result
|
||||
SELECT datasource AS id, id AS result
|
||||
FROM ${stats_db_name}.result_datasources; /*EOS*/
|
||||
|
|
Loading…
Reference in New Issue