pub struct Fragment {
pub id: u64,
pub files: Vec<DataFile>,
pub overlays: Vec<DataOverlayFile>,
pub deletion_file: Option<DeletionFile>,
pub row_id_meta: Option<RowIdMeta>,
pub physical_rows: Option<usize>,
pub last_updated_at_version_meta: Option<RowDatasetVersionMeta>,
pub created_at_version_meta: Option<RowDatasetVersionMeta>,
}Expand description
Data fragment.
A fragment is a set of files which represent the different columns of the same rows.
If column exists in the schema, but the related file does not exist, treat this column as nulls.
Fields§
§id: u64Fragment ID
files: Vec<DataFile>Files within the fragment.
overlays: Vec<DataOverlayFile>Overlay files supplying new values for a subset of cells without
rewriting the base data files. Order is significant: a later entry is
newer than an earlier one. See DataOverlayFile for resolution rules.
deletion_file: Option<DeletionFile>Optional file with deleted local row offsets.
row_id_meta: Option<RowIdMeta>RowIndex
physical_rows: Option<usize>Original number of rows in the fragment. If this is None, then it is unknown. This is only optional for legacy reasons. All new tables should have this set.
last_updated_at_version_meta: Option<RowDatasetVersionMeta>Last updated at version metadata
created_at_version_meta: Option<RowDatasetVersionMeta>Created at version metadata
Implementations§
Source§impl Fragment
impl Fragment
pub fn new(id: u64) -> Fragment
pub fn num_rows(&self) -> Option<usize>
Sourcepub fn referenced_lance_files(&self) -> impl Iterator<Item = &DataFile>
pub fn referenced_lance_files(&self) -> impl Iterator<Item = &DataFile>
Every Lance-format file this fragment references: the base data files
plus the data file of each overlay. The fragment’s other referenced
files are not in this format: a deletion file is .arrow or .bin, and
external row-id or row-version metadata is a raw byte range.
Prefer this over files, which is the base data files only and so omits
overlays.
Sourcepub fn referenced_lance_files_mut(
&mut self,
) -> impl Iterator<Item = &mut DataFile>
pub fn referenced_lance_files_mut( &mut self, ) -> impl Iterator<Item = &mut DataFile>
Mutable counterpart of Self::referenced_lance_files, for rewriting
the fields a clone has to normalize (base_id) across base and overlay
files alike.
Sourcepub fn has_spilled_row_lineage(&self) -> bool
pub fn has_spilled_row_lineage(&self) -> bool
Whether any of this fragment’s row lineage sequences lives in a data file column rather than inline.
Sourcepub fn row_lineage_file(
&self,
field_id: i32,
) -> Result<Option<&DataFile>, Error>
pub fn row_lineage_file( &self, field_id: i32, ) -> Result<Option<&DataFile>, Error>
The data file holding the row lineage column with the reserved
field_id, which is the one entry of Self::files whose fields carry
it. None when no file does, which for a sequence whose metadata says
it is spilled is corruption; so is more than one file carrying the id,
which this reports as an error.
Sourcepub fn spilled_row_lineage_field_ids(&self) -> Vec<i32>
pub fn spilled_row_lineage_field_ids(&self) -> Vec<i32>
The reserved field ids of the row lineage sequences this fragment
marks as spilled: ROW_ID_FIELD_ID when its row ids are, and
likewise ROW_CREATED_AT_VERSION_FIELD_ID and
ROW_LAST_UPDATED_AT_VERSION_FIELD_ID for its versions.
These ids are never in the dataset schema, so code that decides whether a data file is still needed by its schema fields has to keep a file carrying one of them as well: that file is the sequence’s only copy.
pub fn from_json(json: &str) -> Result<Fragment, Error>
Sourcepub fn with_file_legacy(
id: u64,
path: &str,
schema: &Schema,
physical_rows: Option<usize>,
) -> Fragment
pub fn with_file_legacy( id: u64, path: &str, schema: &Schema, physical_rows: Option<usize>, ) -> Fragment
Create a Fragment with one DataFile
pub fn with_file( self, path: impl Into<String>, field_ids: Vec<i32>, column_indices: Vec<i32>, version: ConcreteFileVersion, file_size_bytes: Option<NonZero<u64>>, ) -> Fragment
pub fn with_physical_rows(self, physical_rows: usize) -> Fragment
pub fn add_file( &mut self, path: impl Into<String>, field_ids: Vec<i32>, column_indices: Vec<i32>, version: ConcreteFileVersion, file_size_bytes: Option<NonZero<u64>>, )
Sourcepub fn add_file_legacy(&mut self, path: &str, schema: &Schema)
pub fn add_file_legacy(&mut self, path: &str, schema: &Schema)
Add a new DataFile to this fragment.
pub fn try_infer_version( fragments: &[Fragment], ) -> Result<Option<ConcreteFileVersion>, Error>
Trait Implementations§
Source§impl DeepSizeOf for Fragment
impl DeepSizeOf for Fragment
fn deep_size_of_children(&self, __context: &mut Context) -> usize
fn deep_size_of(&self) -> usize
Source§impl<'de> Deserialize<'de> for Fragment
impl<'de> Deserialize<'de> for Fragment
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Fragment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Fragment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Fragment
Source§impl From<&Fragment> for DataFragment
impl From<&Fragment> for DataFragment
Source§fn from(f: &Fragment) -> DataFragment
fn from(f: &Fragment) -> DataFragment
Source§impl From<FileFragment> for Fragment
impl From<FileFragment> for Fragment
Source§fn from(fragment: FileFragment) -> Self
fn from(fragment: FileFragment) -> Self
Source§impl Serialize for Fragment
impl Serialize for Fragment
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Fragment
Auto Trait Implementations§
impl Freeze for Fragment
impl RefUnwindSafe for Fragment
impl Send for Fragment
impl Sync for Fragment
impl Unpin for Fragment
impl UnsafeUnpin for Fragment
impl UnwindSafe for Fragment
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.