Describe the bug
upsert_value_set MERGEs :ValueSet by column_ref, while add_term_to_value_set MERGEs by name only. If add_term_to_value_set runs before batch_upsert_value_sets, the first MERGE creates a :ValueSet with no column_ref, and the later MERGE then creates a second node with the same name. The graph ends up with duplicate :ValueSet nodes.
To reproduce
- Run
upsert_decoded_values on assertions that include HAS_DECODED_VALUE.
- Query:
MATCH (vs:ValueSet) RETURN vs.name, count(*) — duplicates appear for any ValueSet that had decoded terms.
Expected behavior
One :ValueSet per (name, column_ref) after a build.
Environment
- Affects all environments
src/sema/graph/materializer_utils.py:upsert_decoded_values
Describe the bug
upsert_value_setMERGEs:ValueSetbycolumn_ref, whileadd_term_to_value_setMERGEs bynameonly. Ifadd_term_to_value_setruns beforebatch_upsert_value_sets, the first MERGE creates a:ValueSetwith nocolumn_ref, and the later MERGE then creates a second node with the same name. The graph ends up with duplicate:ValueSetnodes.To reproduce
upsert_decoded_valueson assertions that includeHAS_DECODED_VALUE.MATCH (vs:ValueSet) RETURN vs.name, count(*)— duplicates appear for any ValueSet that had decoded terms.Expected behavior
One
:ValueSetper(name, column_ref)after a build.Environment
src/sema/graph/materializer_utils.py:upsert_decoded_values