Expand description
Apache Arrow bridge for openmassspec_core::SpectrumRecord.
It exposes:
spectrum_record_schema: the canonical ArrowSchemafor a stream ofSpectrumRecords.SpectrumBatchBuilder: a streaming builder that accumulates rows and produces aRecordBatchwhen finalized.
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§
- Spectrum
Batch Builder - Streaming builder that accumulates
SpectrumRecords and produces a single ArrowRecordBatchwhen finalized.
Functions§
- spectrum_
record_ schema - Return the canonical
Schemafor aRecordBatchof spectra.