Skip to content

Fix CDM cache warming when cache.achilles.usePersonCount is false - #2562

Open
DG47 wants to merge 2 commits into
OHDSI:masterfrom
DG47:fix/cdm-cache-batch-count-alias
Open

DG47 wants to merge 2 commits into
OHDSI:masterfrom
DG47:fix/cdm-cache-batch-count-alias

Conversation

@DG47

@DG47 DG47 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #2561

Follow-up to #2517. With cache.achilles.usePersonCount=false, CDM cache warming still fails after the placeholder rename in a9720e7. This PR fixes two problems on that path:

  • Batch count query: getBatchConceptRecordCount.sql references cc.concept_id without declaring the cc alias. Warming fails with missing FROM-clause entry for table "cc" (PostgreSQL) or The multi-part identifier "cc.concept_id" could not be bound (SQL Server). CDMCacheService.warm catches and logs the error, so nothing gets cached. The fix adds the alias, which makes the file match getBatchConceptRecordPersonCount.sql.
  • Re-warming cached concepts: CDMCacheBatchService.save compares the new and cached counts by unboxing them into a long[]. With usePersonCount=false the person counts are null, so re-warming a concept already in cdm_cache throws a NullPointerException. The fix compares the boxed Long values with Arrays.equals(Object[], Object[]), which handles nulls.

The default usePersonCount=true path is unchanged.

Tests

  • CDMCacheServiceWarmTest runs CDMCacheService.warm against the embedded PostgreSQL instance, with and without person counts. Before the fix, the usePersonCount=false case cached nothing because of the SQL error. It passes now.
  • CDMCacheBatchServiceTest covers saving entries without person counts over existing cache entries, both unchanged and changed. Both cases threw a NullPointerException before the fix.

mvn -B test: 144 unit tests, 0 failures, 5 skipped. The integration tests that run in the same build all pass except 3 in VocabularyServiceIT (canGetConcept, canGetVocabularies, canGetDomains return 404). Those 3 fail the same way on unmodified master.

DG47 added 2 commits October 18, 2026 06:30
getBatchConceptRecordCount.sql selects and filters on cc.concept_id but
never declares the cc alias, so warming the CDM cache with
cache.achilles.usePersonCount=false fails on every dialect ("missing
FROM-clause entry for table cc" on PostgreSQL, "The multi-part identifier
could not be bound" on SQL Server). The person count variant already
declares the alias.
With cache.achilles.usePersonCount=false the person counts of cache
entries are null, and unboxing them into a long[] threw a
NullPointerException whenever an already cached concept was warmed again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CDM cache warming still fails when cache.achilles.usePersonCount=false (missing cc alias in getBatchConceptRecordCount.sql)

1 participant