Repository navigation
[FIX,TEST] ParquetDiff: restore observed_mz to the QPX feature primary key - #9877
Conversation
…y key
ParquetTableComparator::qpxPrimaryKey("feature") returned four columns
(peptidoform, charge, run_file_name, rt) where QPXValueValidation enforces five.
'observed_mz' is in that key for the sake of the unmapped rows, which QPX permits
and ConsensusMapArrowExport writes with an empty peptidoform. Without it the key
collapses to (charge, run_file_name, rt), and 'rt' is float32 on write - one ULP
is 244 us at a retention time of 3000 s - so two co-eluting unmapped features of
one charge in one run share a key although they are plainly different features.
The consequence is worse than a spurious duplicate report. buildKeys_ compares
only the first row of a duplicate key, so the second row's values were never
compared at all: a value assertion over such a file would have passed while
silently ignoring half its rows. Demonstrated, not argued - with the fix reverted,
the new section's "a change confined to the second row must be reported"
assertion fails, i.e. the change produces no value error whatsoever.
Latent rather than live: no QPX feature table any current test produces collides
under the four-column key. But BSA_qpx_seeds_dir carries 210 empty peptidoforms
in 298 rows, and its closest same-(peptidoform, charge, run) retention-time pair
is 9 float32 ULPs apart (9.7e-7 relative). It would have bitten as soon as
anything compared a feature table - which is exactly what the QPX value
assertions of OpenMS#9864 Phase 0.1 set out to do, and why this is fixed first.
The existing test asserted feature.size() == 4, so it had frozen the defect. It
now pins all five column names, and a new section builds the colliding shape
directly: two unmapped features at the same float32 rt in one run differing only
in observed_mz. It asserts both are matched with no duplicate-key error, that a
change to the second is reported, and - so the section cannot go vacuous - that
the four-column key really does collide on that input.
Part of OpenMS#9864.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesThe QPX feature primary key now includes QPX feature matching
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ParquetTableComparator::qpxPrimaryKey("feature")returned four columns —(peptidoform, charge, run_file_name, rt)— whereQPXValueValidationenforces five. The two must not disagree: a file validation accepts is then one this comparator silently drops rows from.Why
observed_mzis load-bearingQPX permits unmapped features and
ConsensusMapArrowExportwrites them with an empty peptidoform. For those rows the four-column key collapses to(charge, run_file_name, rt)— andrtisfloat32on write, where one ULP is 244 µs at a retention time of 3000 s. Two co-eluting unmapped features of one charge in one run therefore share a key although they are plainly different features.This is the same reasoning #9825 recorded when it added the column ("Do not drop it back out"); #9865 landed afterwards and dropped it.
The consequence is worse than a duplicate report
buildKeys_compares only the first row of a duplicate key. So the second row's values were never compared at all — a value assertion over such a file would have passed green while silently ignoring half its rows.That is demonstrated, not argued. With the fix reverted, the new section fails on six assertions, and the decisive one is "a change confined to the second row must be reported": under the four-column key that change produces no value error whatsoever.
Latent, not live
No QPX feature table any current test produces collides under the four-column key — I checked all five. Stating that plainly rather than overselling the fix.
But it is close, and it was invisible for a structural reason: every QPX assertion in the suite is a
sha256sumexistence check, so nothing compares a feature table at all. Margin in the richest fixture:BSA_qpx_seeds_dirBSA_qpx_dirIsobaricWorkflow_qpx_dirProteinQuantifier_18/19_qpx_dirIn
BSA_qpx_seeds_dirthe closest same-(peptidoform, charge, run_file_name)retention-time pair is 9 float32 ULPs apart (9.7e-7 relative) — key('', 2, 'BSA2_F2'), rt2255.501953125vs2255.504150390625. It would have bitten as soon as anything compared a feature table, which is exactly what #9864's Phase 0.1 QPX value assertions set out to do. Hence fixing it first, on its own.Test
The existing section asserted
feature.size() == 4— it had frozen the defect. It now pins all five column names, and a new section builds the colliding shape directly: two unmapped features at the samefloat32rt in one run, differing only inobserved_mz. It asserts both are matched with no duplicate-key error, that a change to the second is reported, and — so the section cannot go vacuous — that the four-column key really does collide on that input.Targeted
ctest -R "ParquetDiff|ParquetTableComparator|qpx": 34/34 pass.Part of #9864 (Phase 0.1).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
Summary by CodeRabbit
Bug Fixes
Tests
Documentation