Skip to main content

Crate openmassspec_arrow

Crate openmassspec_arrow 

Source
Expand description

Apache Arrow bridge for openmassspec_core::SpectrumRecord.

It exposes:

use openmassspec_arrow::SpectrumBatchBuilder;
use openmassspec_core::SpectrumRecord;

let mut builder = SpectrumBatchBuilder::new(None);
builder.push(
    &SpectrumRecord::new(0, 1, "scan=1").with_peaks(vec![100.0], vec![5.0]),
);
let batch = builder.finish().unwrap();
assert_eq!(batch.num_rows(), 1);

Enum columns hold the stable labels from each enum’s as_str method (e.g. Analyzer::as_str).

The schema is intentionally flat (one row per spectrum). Peak arrays are stored as LargeList<Float64> / LargeList<Float32> so that individual spectra can exceed i32::MAX peaks without truncation. Precursor fields are inlined as nullable scalar columns; an MS1 spectrum has all precursor columns null. This shape is friendly to Polars / DataFusion / DuckDB consumers.

The Arrow schema is part of this crate’s stable surface: any column addition is a minor-version bump, any removal or rename is breaking.

Structs§

SpectrumBatchBuilder
Streaming builder that accumulates SpectrumRecords and produces a single Arrow RecordBatch when finalized.

Functions§

spectrum_record_schema
Return the canonical Schema for a RecordBatch of spectra.