[stats] affiliations in stats and monitor dbs #152
|
@ -30,6 +30,8 @@ hdfs dfs -copyFromLocal concepts.csv ${TMP}
|
||||||
hdfs dfs -chmod -R 777 ${TMP}
|
hdfs dfs -chmod -R 777 ${TMP}
|
||||||
|
|
||||||
echo "Creating and populating impala tables"
|
echo "Creating and populating impala tables"
|
||||||
|
impala-shell -q "invalidate metadata"
|
||||||
|
impala-shell -d ${TARGET_DB} -q "invalidate metadata"
|
||||||
impala-shell -q "create table ${TARGET_DB}.context (id string, name string) row format delimited fields terminated by ','"
|
impala-shell -q "create table ${TARGET_DB}.context (id string, name string) row format delimited fields terminated by ','"
|
||||||
impala-shell -q "create table ${TARGET_DB}.category (context string, id string, name string) row format delimited fields terminated by ','"
|
impala-shell -q "create table ${TARGET_DB}.category (context string, id string, name string) row format delimited fields terminated by ','"
|
||||||
impala-shell -q "create table ${TARGET_DB}.concept (category string, id string, name string) row format delimited fields terminated by ','"
|
impala-shell -q "create table ${TARGET_DB}.concept (category string, id string, name string) row format delimited fields terminated by ','"
|
||||||
|
|
|
@ -17,7 +17,7 @@ create table TARGET.result as
|
||||||
union all
|
union all
|
||||||
select * from SOURCE.result r where exists (select 1 from SOURCE.result_concepts rc where rc.id=r.id)
|
select * from SOURCE.result r where exists (select 1 from SOURCE.result_concepts rc where rc.id=r.id)
|
||||||
union all
|
union all
|
||||||
select * from SOURCE.result r where exists (select 1 from SOURCE.result_projects rp join SOURCE.project p on p.id=rp.project join SOURCE.project_organizations po on po.id=p.id where rp.id=r.id and po.organization in (
|
select * from SOURCE.result r where exists (select 1 from SOURCE.result_organization ro where ro.id=r.id and ro.organization in (
|
||||||
'openorgs____::759d59f05d77188faee99b7493b46805',
|
'openorgs____::759d59f05d77188faee99b7493b46805',
|
||||||
'openorgs____::b84450f9864182c67b8611b5593f4250',
|
'openorgs____::b84450f9864182c67b8611b5593f4250',
|
||||||
'openorgs____::d41cf6bd4ab1b1362a44397e0b95c975',
|
'openorgs____::d41cf6bd4ab1b1362a44397e0b95c975',
|
||||||
|
|
|
@ -126,7 +126,7 @@ FROM ${stats_db_name}.otherresearchproduct_topics;
|
||||||
CREATE TABLE ${stats_db_name}.result_organization AS
|
CREATE TABLE ${stats_db_name}.result_organization AS
|
||||||
SELECT substr(r.target, 4) AS id, substr(r.source, 4) AS organization
|
SELECT substr(r.target, 4) AS id, substr(r.source, 4) AS organization
|
||||||
FROM ${openaire_db_name}.relation r
|
FROM ${openaire_db_name}.relation r
|
||||||
WHERE r.reltype = 'resultOrganization'
|
WHERE r.reltype = 'resultOrganization' and r.relclass='hasAuthorInstitution' and r.subreltype='affiliation'
|
||||||
and r.datainfo.deletedbyinference = false;
|
and r.datainfo.deletedbyinference = false;
|
||||||
|
|
||||||
CREATE TABLE ${stats_db_name}.result_projects AS
|
CREATE TABLE ${stats_db_name}.result_projects AS
|
||||||
|
|
Loading…
Reference in New Issue