Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions arrow-ipc/src/reader/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ pub struct StreamDecoder {
require_alignment: bool,
/// Should validation be skipped when reading data? Defaults to false.
///
/// See [`FileDecoder::with_skip_validation`] for details.
/// See [`StreamDecoder::with_skip_validation`] for details.
///
/// [`FileDecoder::with_skip_validation`]: crate::reader::FileDecoder::with_skip_validation
skip_validation: UnsafeFlag,
}

Expand Down Expand Up @@ -114,6 +113,20 @@ impl StreamDecoder {
self.schema.as_ref().map(|schema| schema.clone())
}

/// Specifies if validation should be skipped when reading data (defaults to `false`)
///
/// # Safety
///
/// This flag must only be set to `true` when you trust the input data and are
/// sure the data you are reading is valid Arrow IPC stream data, otherwise
/// undefined behavior may result.
///
/// For example, DataFusion uses this when reading spill files it wrote itself.
pub unsafe fn with_skip_validation(mut self, skip_validation: bool) -> Self {
unsafe { self.skip_validation.set(skip_validation) };
self
}

/// Try to read the next [`RecordBatch`] from the provided [`Buffer`]
///
/// [`Buffer::advance`] will be called on `buffer` for any consumed bytes.
Expand Down
Loading