Changes

Summary

  1. feat(sciance): standalone dhp-sciance-stats oozie workflow (details)
  2. fix(sciance): target Spark SQL, follow stats-update copy/shadow logic (details)
  3. fix(sciance): run script uses spark-35 profile and sciance-stats source dir (details)
  4. fix(sciance): give the impala copy shell action the impalaCluster HA config (details)
  5. feat(sciance): dhp-sciance-promote workflow (details)
  6. fix(sciance): materialize organization_type instead of a view over the stats DB (details)
  7. fix(sciance): restore the technology taxonomy views (details)
  8. feat(sciance): apply the organisation deduplication to the sciance stats DB (details)
  9. fix(sciance): skip marker files when picking the schema file for impala tables (details)
  10. fix(sciance): skip non-parquet tables instead of failing the impala copy (details)
  11. fix(sciance): read the format check from the Ocean file and never skip on a read error (details)
  12. fix(stats): drop result VIEW before TABLE to avoid Spark AnalysisException on restart (details)
  13. fix(stats): harden result DROP ordering and idempotency test (details)
Commit 51981672c6641da6995d4031fb0c1ee8f8141057 by Antonis Lempesis
feat(sciance): standalone dhp-sciance-stats oozie workflow

Extract the sciance stats build from the dhp-stats-update step20 into its own
module/workflow: build sciance stats DB in ocean (ScianceStatsDB), copy
sciance source DB + stats DB + shadow to impala, create the impala shadow DB.
The stats tool cache update step is included but disabled (see README).

Ported from feat/sciance-stats-integration, including the removal of views
over the dropped technology taxonomy tables (sciance_v10).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was addeddhp-sciance-stats/pom.xml
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
The file was addeddhp-sciance-stats/installProject.sh
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/updateCache.sh
The file was addeddhp-sciance-stats/README.md
The file was addeddhp-sciance-stats/job-override.properties-ant
The file was addeddhp-sciance-stats/src/main/java/eu/dnetlib/dhp/oa/graph/sciance/ScianceStatsDB.java
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/finalizeScianceImpala.sh
The file was addeddhp-sciance-stats/job-override.properties-prod
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/config-default.xml
The file was addeddhp-sciance-stats/runOozieWorkfow.sh
The file was modifiedpom.xml
The file was addeddhp-sciance-stats/job-override.properties-beta
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceAggTables.sql
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
Commit 25c9c181816beb94fc9871b571f97ee1c026dae8 by Antonis Lempesis
fix(sciance): target Spark SQL, follow stats-update copy/shadow logic

- result filter back to dual EXISTS, monitor sql identical to main (the Hive 1.1
  rewrites are not for the repo; test with Hive in a local copy only)
- do not copy shadow DBs to impala (stats-update logic): ocean shadow is created
  by step1, impala shadow by step3

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
The file was modifieddhp-sciance-stats/README.md
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
Commit d13032b21200459f049a9cd39b8bccf8ad75ea9e by Antonis Lempesis
fix(sciance): run script uses spark-35 profile and sciance-stats source dir

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/runOozieWorkfow.sh
Commit c277e9fbefbfa68a67da64904562a92194c5a2cd by Antonis Lempesis
fix(sciance): give the impala copy shell action the impalaCluster HA config

The conf dir Oozie generates for shell actions only knows nameservice1, so the
guard in copyDataToImpalaCluster_v2.sh (and distcp) fail with
"Cannot reach Impala HDFS via hdfs://impalaCluster". Pass the HA properties
in the action configuration. Verified with a throwaway shell workflow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
Commit a5d1d2e08cce06f0571c3330222a858f5f7b8274 by Antonis Lempesis
feat(sciance): dhp-sciance-promote workflow

New module: promote the versioned sciance stats DB to production on impala
(drop + recreate the production DB as views over it, via the generic
updateProductionViews.sh), followed by a stats tool cache promote step that is
included but disabled (enablePromoteCache=false, see README).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was addeddhp-sciance-promote/job-override.properties-prod
The file was modifiedpom.xml
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/updateProductionViews.sh
The file was addeddhp-sciance-promote/job-override.properties-beta
The file was addeddhp-sciance-promote/pom.xml
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/workflow.xml
The file was addeddhp-sciance-promote/job-override.properties-ant
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/config-default.xml
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/promoteCache.sh
The file was addeddhp-sciance-promote/README.md
The file was addeddhp-sciance-promote/runOozieWorkfow.sh
Commit c1f1ff48fa227412112a7171479271e97e9e6bc4 by Antonis Lempesis
fix(sciance): materialize organization_type instead of a view over the stats DB

The impala copy of the stats DB can lack organization_type (it was added later),
so the view cannot be created on impala and the copy step dies in its view retry
loop. A small real table makes the sciance DB self-contained.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
Commit d4ce7fce87363aaa2485b3149e14ea5b471ff5bd by Antonis Lempesis
fix(sciance): restore the technology taxonomy views

The taxonomy tables are needed after all (stats tool profile, dashboard
methodology page). sciance_v10 contains them again, so create the ten views
over them in the versioned DB.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/README.md
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
Commit a8df959b2676aa727575dbafbe49d5d027724019 by Antonis Lempesis
feat(sciance): apply the organisation deduplication to the sciance stats DB

New step20-applyOrgDedup.sql, run as phase 2b of ScianceStatsDB (after the
filtered copy of the result_* tables, before the agg tables): result_organization
is remapped to canonical org ids, excluded orgs are dropped and duplicate
(result, org) pairs removed; organization becomes a table with one row per
canonical org (normalised name/type/country) next to the unmapped orgs. The
mapping comes from the new sciance_vN.organization_normalised table, which is
also exposed as a view in the versioned DB.

Checked on a scratch DB with the real data (CAS: 409,969 results before and
after the merge; no merged-away or excluded ids left; organization
508,812 -> 508,795 rows).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-applyOrgDedup.sql
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
The file was modifieddhp-sciance-stats/src/main/java/eu/dnetlib/dhp/oa/graph/sciance/ScianceStatsDB.java
Commit 37ed469fc59e410106def6dce79dc2417201c5b2 by Antonis Lempesis
fix(sciance): skip marker files when picking the schema file for impala tables

Same fix as in dhp-stats-update (copyDataToImpalaCluster_v2.sh is shared code):
the first directory entry can be _SUCCESS, which is not parquet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 1bbaa0547aaacdfa538f980dea0576780b1cb651 by Antonis Lempesis
fix(sciance): skip non-parquet tables instead of failing the impala copy

Same change as dhp-stats-update (copyDataToImpalaCluster_v2.sh is shared code
and must stay identical): check the PAR1 magic of the schema file and skip text
tables with a warning.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 605e34c4e24355ae72e1e1bf1931f17a474bbcd8 by Antonis Lempesis
fix(sciance): read the format check from the Ocean file and never skip on a read error

Same correction as dhp-stats-update (the script is shared code and must stay
identical): the Impala datanodes are not readable from every host, so read the
magic bytes from the Ocean copy, fail on unreadable files, ignore empty files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 9dff3b5504eb0e1f9eedeba615716d4c036c0b74 by Antonis Lempesis
fix(stats): drop result VIEW before TABLE to avoid Spark AnalysisException on restart

Spark SQL raises AnalysisException on `DROP TABLE IF EXISTS` when the
named object is a VIEW, even when IF EXISTS is specified. On DB name
reuse (e.g. restarting the workflow from step12), `result` is still
present as a VIEW from the previous run, causing the workflow to fail.

Add `DROP VIEW IF EXISTS ${stats_db_name}.result` immediately before
the existing `DROP TABLE IF EXISTS` line in both step7.sql and
step12.sql so the object is removed regardless of its current type.

Update SqlIdempotencyTest to emit a FAIL issue when DROP TABLE IF
EXISTS targets an object that is tracked as a VIEW, surfacing this
class of bug at test time rather than at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file was modifieddhp-stats-update/src/test/java/eu/dnetlib/dhp/oa/graph/stats/SqlIdempotencyTest.java
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step12.sql
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step7.sql
Commit 813c4df2fa9139ae07102993b89d5ef968b424c0 by Antonis Lempesis
fix(stats): harden result DROP ordering and idempotency test

step7: DROP TABLE IF EXISTS before DROP VIEW IF EXISTS so result=TABLE
(left by step16_5 of a prior run) is safely removed before the VIEW
drop, which would throw on a TABLE in Spark even with IF EXISTS.

SqlIdempotencyTest:
- Add CREATE_TEMP_VIEW action; step16 inline temp-view pairs no longer
  produce false-positive FAIL reports.
- Flag DROP_VIEW_IF on TABLE, DROP_TABLE bare on VIEW/TEMP_VIEW, and
  DROP_VIEW bare on TABLE as FAIL (Spark throws on type mismatch even
  with IF EXISTS).
- Change testSafeToResumeFromAnyStep to use the in-progress state
  model: for each step i, initial state = result of running steps
  0..i-1 from empty. This matches actual Oozie retry semantics (all
  prior steps in the current run have already completed) and eliminates
  false positives from the TABLE<->VIEW lifecycle of result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file was modifieddhp-stats-update/src/test/java/eu/dnetlib/dhp/oa/graph/stats/SqlIdempotencyTest.java
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step7.sql

Summary

  1. feat(sciance): standalone dhp-sciance-stats oozie workflow (details)
  2. fix(sciance): target Spark SQL, follow stats-update copy/shadow logic (details)
  3. fix(sciance): run script uses spark-35 profile and sciance-stats source dir (details)
  4. fix(sciance): give the impala copy shell action the impalaCluster HA config (details)
  5. feat(sciance): dhp-sciance-promote workflow (details)
  6. fix(sciance): materialize organization_type instead of a view over the stats DB (details)
  7. fix(sciance): restore the technology taxonomy views (details)
  8. feat(sciance): apply the organisation deduplication to the sciance stats DB (details)
  9. fix(sciance): skip marker files when picking the schema file for impala tables (details)
  10. fix(sciance): skip non-parquet tables instead of failing the impala copy (details)
  11. fix(sciance): read the format check from the Ocean file and never skip on a read error (details)
  12. fix(stats): drop result VIEW before TABLE to avoid Spark AnalysisException on restart (details)
  13. fix(stats): harden result DROP ordering and idempotency test (details)
Commit 51981672c6641da6995d4031fb0c1ee8f8141057 by Antonis Lempesis
feat(sciance): standalone dhp-sciance-stats oozie workflow

Extract the sciance stats build from the dhp-stats-update step20 into its own
module/workflow: build sciance stats DB in ocean (ScianceStatsDB), copy
sciance source DB + stats DB + shadow to impala, create the impala shadow DB.
The stats tool cache update step is included but disabled (see README).

Ported from feat/sciance-stats-integration, including the removal of views
over the dropped technology taxonomy tables (sciance_v10).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was addeddhp-sciance-stats/src/main/java/eu/dnetlib/dhp/oa/graph/sciance/ScianceStatsDB.java
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/config-default.xml
The file was addeddhp-sciance-stats/job-override.properties-prod
The file was addeddhp-sciance-stats/pom.xml
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
The file was modifiedpom.xml
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/updateCache.sh
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceAggTables.sql
The file was addeddhp-sciance-stats/README.md
The file was addeddhp-sciance-stats/job-override.properties-ant
The file was addeddhp-sciance-stats/runOozieWorkfow.sh
The file was addeddhp-sciance-stats/job-override.properties-beta
The file was addeddhp-sciance-stats/installProject.sh
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/finalizeScianceImpala.sh
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
Commit 25c9c181816beb94fc9871b571f97ee1c026dae8 by Antonis Lempesis
fix(sciance): target Spark SQL, follow stats-update copy/shadow logic

- result filter back to dual EXISTS, monitor sql identical to main (the Hive 1.1
  rewrites are not for the repo; test with Hive in a local copy only)
- do not copy shadow DBs to impala (stats-update logic): ocean shadow is created
  by step1, impala shadow by step3

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
The file was modifieddhp-sciance-stats/README.md
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
Commit d13032b21200459f049a9cd39b8bccf8ad75ea9e by Antonis Lempesis
fix(sciance): run script uses spark-35 profile and sciance-stats source dir

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/runOozieWorkfow.sh
Commit c277e9fbefbfa68a67da64904562a92194c5a2cd by Antonis Lempesis
fix(sciance): give the impala copy shell action the impalaCluster HA config

The conf dir Oozie generates for shell actions only knows nameservice1, so the
guard in copyDataToImpalaCluster_v2.sh (and distcp) fail with
"Cannot reach Impala HDFS via hdfs://impalaCluster". Pass the HA properties
in the action configuration. Verified with a throwaway shell workflow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/workflow.xml
Commit a5d1d2e08cce06f0571c3330222a858f5f7b8274 by Antonis Lempesis
feat(sciance): dhp-sciance-promote workflow

New module: promote the versioned sciance stats DB to production on impala
(drop + recreate the production DB as views over it, via the generic
updateProductionViews.sh), followed by a stats tool cache promote step that is
included but disabled (enablePromoteCache=false, see README).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was addeddhp-sciance-promote/job-override.properties-ant
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/promoteCache.sh
The file was addeddhp-sciance-promote/README.md
The file was addeddhp-sciance-promote/job-override.properties-beta
The file was addeddhp-sciance-promote/job-override.properties-prod
The file was modifiedpom.xml
The file was addeddhp-sciance-promote/runOozieWorkfow.sh
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/config-default.xml
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/workflow.xml
The file was addeddhp-sciance-promote/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-promote/oozie_app/updateProductionViews.sh
The file was addeddhp-sciance-promote/pom.xml
Commit c1f1ff48fa227412112a7171479271e97e9e6bc4 by Antonis Lempesis
fix(sciance): materialize organization_type instead of a view over the stats DB

The impala copy of the stats DB can lack organization_type (it was added later),
so the view cannot be created on impala and the copy step dies in its view retry
loop. A small real table makes the sciance DB self-contained.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createMonitorDB.sql
Commit d4ce7fce87363aaa2485b3149e14ea5b471ff5bd by Antonis Lempesis
fix(sciance): restore the technology taxonomy views

The taxonomy tables are needed after all (stats tool profile, dashboard
methodology page). sciance_v10 contains them again, so create the ten views
over them in the versioned DB.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/README.md
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
Commit a8df959b2676aa727575dbafbe49d5d027724019 by Antonis Lempesis
feat(sciance): apply the organisation deduplication to the sciance stats DB

New step20-applyOrgDedup.sql, run as phase 2b of ScianceStatsDB (after the
filtered copy of the result_* tables, before the agg tables): result_organization
is remapped to canonical org ids, excluded orgs are dropped and duplicate
(result, org) pairs removed; organization becomes a table with one row per
canonical org (normalised name/type/country) next to the unmapped orgs. The
mapping comes from the new sciance_vN.organization_normalised table, which is
also exposed as a view in the versioned DB.

Checked on a scratch DB with the real data (CAS: 409,969 results before and
after the merge; no merged-away or excluded ids left; organization
508,812 -> 508,795 rows).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/java/eu/dnetlib/dhp/oa/graph/sciance/ScianceStatsDB.java
The file was addeddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-applyOrgDedup.sql
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/scripts/step20-createScianceDB.sql
Commit 37ed469fc59e410106def6dce79dc2417201c5b2 by Antonis Lempesis
fix(sciance): skip marker files when picking the schema file for impala tables

Same fix as in dhp-stats-update (copyDataToImpalaCluster_v2.sh is shared code):
the first directory entry can be _SUCCESS, which is not parquet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 1bbaa0547aaacdfa538f980dea0576780b1cb651 by Antonis Lempesis
fix(sciance): skip non-parquet tables instead of failing the impala copy

Same change as dhp-stats-update (copyDataToImpalaCluster_v2.sh is shared code
and must stay identical): check the PAR1 magic of the schema file and skip text
tables with a warning.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 605e34c4e24355ae72e1e1bf1931f17a474bbcd8 by Antonis Lempesis
fix(sciance): read the format check from the Ocean file and never skip on a read error

Same correction as dhp-stats-update (the script is shared code and must stay
identical): the Impala datanodes are not readable from every host, so read the
magic bytes from the Ocean copy, fail on unreadable files, ignore empty files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The file was modifieddhp-sciance-stats/src/main/resources/eu/dnetlib/dhp/oa/graph/sciance-stats/oozie_app/copyDataToImpalaCluster_v2.sh
Commit 9dff3b5504eb0e1f9eedeba615716d4c036c0b74 by Antonis Lempesis
fix(stats): drop result VIEW before TABLE to avoid Spark AnalysisException on restart

Spark SQL raises AnalysisException on `DROP TABLE IF EXISTS` when the
named object is a VIEW, even when IF EXISTS is specified. On DB name
reuse (e.g. restarting the workflow from step12), `result` is still
present as a VIEW from the previous run, causing the workflow to fail.

Add `DROP VIEW IF EXISTS ${stats_db_name}.result` immediately before
the existing `DROP TABLE IF EXISTS` line in both step7.sql and
step12.sql so the object is removed regardless of its current type.

Update SqlIdempotencyTest to emit a FAIL issue when DROP TABLE IF
EXISTS targets an object that is tracked as a VIEW, surfacing this
class of bug at test time rather than at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step7.sql
The file was modifieddhp-stats-update/src/test/java/eu/dnetlib/dhp/oa/graph/stats/SqlIdempotencyTest.java
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step12.sql
Commit 813c4df2fa9139ae07102993b89d5ef968b424c0 by Antonis Lempesis
fix(stats): harden result DROP ordering and idempotency test

step7: DROP TABLE IF EXISTS before DROP VIEW IF EXISTS so result=TABLE
(left by step16_5 of a prior run) is safely removed before the VIEW
drop, which would throw on a TABLE in Spark even with IF EXISTS.

SqlIdempotencyTest:
- Add CREATE_TEMP_VIEW action; step16 inline temp-view pairs no longer
  produce false-positive FAIL reports.
- Flag DROP_VIEW_IF on TABLE, DROP_TABLE bare on VIEW/TEMP_VIEW, and
  DROP_VIEW bare on TABLE as FAIL (Spark throws on type mismatch even
  with IF EXISTS).
- Change testSafeToResumeFromAnyStep to use the in-progress state
  model: for each step i, initial state = result of running steps
  0..i-1 from empty. This matches actual Oozie retry semantics (all
  prior steps in the current run have already completed) and eliminates
  false positives from the TABLE<->VIEW lifecycle of result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file was modifieddhp-stats-update/src/main/resources/eu/dnetlib/dhp/oa/graph/stats/oozie_app/scripts/step7.sql
The file was modifieddhp-stats-update/src/test/java/eu/dnetlib/dhp/oa/graph/stats/SqlIdempotencyTest.java