Repository navigation
[OpenSWATH] Make Parquet score exporter throw instead of abort on Arrow errors - #9778
Conversation
…rrow errors (OpenMS#9739) The flat feature-score/transition-score Parquet exporter finalized every Arrow array builder with Finish().ValueOrDie(), which calls std::abort() on an Arrow error and terminates the process. This was also internally inconsistent: builder Append() failures were already routed through a throwing helper while finalization aborted. Route both appending and finalization through the shared ParquetFile::appendOrThrow() and ParquetFile::finishArray() helpers (matching OpenSwathOSWParquetWriter), so an Arrow failure throws Exception::InvalidValue naming the offending column instead of aborting. The duplicate local appendOrThrow_ helper is removed. Output schema and data are unchanged.
📝 WalkthroughWalkthrough
ChangesOpenSWATH Parquet error handling
Possibly related PRs
Suggested reviewers: 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp (1)
109-120: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winPer-row column-name string is rebuilt on every row/column iteration.
columnis concatenated fresh for every row × MS1/MS2 column, then.c_str()forces an extra implicitstd::stringreconstruction when passed intoParquetFile::appendOrThrow(const std::string&, ...). For large exports this adds avoidable allocations on the hot path.⚡ Precompute column names once before the row loop
+ std::vector<std::string> ms1_columns(table.feature_ms1_column_names.size()); + for (Size i = 0; i < ms1_columns.size(); ++i) ms1_columns[i] = "FEATURE_MS1_" + table.feature_ms1_column_names[i]; + std::vector<std::string> ms2_columns(table.feature_ms2_column_names.size()); + for (Size i = 0; i < ms2_columns.size(); ++i) ms2_columns[i] = "FEATURE_MS2_" + table.feature_ms2_column_names[i]; + for (const auto& row : table.rows) { ... for (Size i = 0; i < table.feature_ms1_column_names.size(); ++i) { - const std::string column = "FEATURE_MS1_" + table.feature_ms1_column_names[i]; - if (i < row.feature_ms1_values.size()) ParquetFile::appendOrThrow(ms1_builders[i].Append(row.feature_ms1_values[i]), column.c_str()); - else ParquetFile::appendOrThrow(ms1_builders[i].AppendNull(), column.c_str()); + if (i < row.feature_ms1_values.size()) ParquetFile::appendOrThrow(ms1_builders[i].Append(row.feature_ms1_values[i]), ms1_columns[i]); + else ParquetFile::appendOrThrow(ms1_builders[i].AppendNull(), ms1_columns[i]); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp` around lines 109 - 120, Precompute the prefixed MS1 and MS2 column-name strings once before the row-processing loop, then reuse the cached names in both appendOrThrow calls. Update the loops in OpenSwathParquetExporter to index those cached names instead of constructing a new std::string for every row and column.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp`:
- Around line 109-120: Precompute the prefixed MS1 and MS2 column-name strings
once before the row-processing loop, then reuse the cached names in both
appendOrThrow calls. Update the loops in OpenSwathParquetExporter to index those
cached names instead of constructing a new std::string for every row and column.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 353c2951-dad3-4584-8422-83737ea4c41c
📒 Files selected for processing (2)
CHANGELOGsrc/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp
singjc
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me.
|
@timosachsenberg You may merge this PR now. |
|
Thanks! |
… fix (#9791) #9790 (14 boundary/serialization/state-consistency fixes from the #9767 audit) had no changelog entry. The existing Arrow-abort entry cited only the tracking issue #9739; #9778 is the PR that actually implemented and merged that fix, so it's now credited alongside it. Claude-Session: https://claude.ai/code/session_01J7SjScz96yXHb7HnBuezhk Co-authored-by: Claude <[email protected]>
Description:
@singjc , @jcharkow Please review:
OpenSwathParquetExporter finalized every Arrow builder with Finish().ValueOrDie(), which calls std::abort() on an Arrow error and kills the process. It was also inconsistent internally: Append() failures already threw, but finalization aborted.
This routes both appending and finalization through the shared ParquetFile::appendOrThrow() and ParquetFile::finishArray() helpers, so a failure now throws Exception::InvalidValue naming the column instead of aborting. That matches how OpenSwathOSWParquetWriter already behaves. The duplicate local appendOrThrow_ helper is removed.
Output schema and data are unchanged, so existing readers are unaffected.
Tested locally: OpenSwathParquetExporter_test and OpenSwathExport_test both pass.
The footer schema-version metadata and column naming are tracked separately, as discussed in the issue.
Checklist
Closes #9739
Summary by CodeRabbit