pub struct CompactionOptions {Show 17 fields
pub target_rows_per_fragment: usize,
pub max_rows_per_group: usize,
pub max_bytes_per_file: Option<usize>,
pub materialize_deletions: bool,
pub materialize_deletions_threshold: f32,
pub num_threads: Option<usize>,
pub batch_size: Option<usize>,
pub io_buffer_size: Option<u64>,
pub defer_index_remap: bool,
pub index_remap_mode: IndexRemapMode,
pub compaction_mode: Option<CompactionMode>,
pub enable_binary_copy: bool,
pub enable_binary_copy_force: bool,
pub binary_copy_read_batch_bytes: Option<usize>,
pub max_source_fragments: Option<usize>,
pub max_overlays_per_fragment: Option<usize>,
pub transaction_properties: Option<Arc<HashMap<String, String>>>,
}Expand description
Options to be passed to compact_files.
Fields§
§target_rows_per_fragment: usizeTarget number of rows per file. Defaults to 1 million.
This is used to determine which fragments need compaction, as any fragments that have fewer rows than this value will be candidates for compaction.
max_rows_per_group: usizeMax number of rows per group
This does not affect which fragments need compaction, but does affect how they are re-written if selected.
max_bytes_per_file: Option<usize>Max number of bytes per file
This does not affect which frgamnets need compaction, but does affect how they are re-written if selected.
If not specified then the default (see WriteParams) will be used.
materialize_deletions: boolWhether to compact fragments with deletions so there are no deletions. Defaults to true.
materialize_deletions_threshold: f32The fraction of rows that need to be deleted in a fragment before materializing the deletions. Defaults to 10% (0.1). Setting to zero (or lower) will materialize deletions for all fragments with deletions. Setting above 1.0 will never materialize deletions.
num_threads: Option<usize>The number of threads to use (how many compaction tasks to run in parallel).
Defaults to the number of compute-intensive CPUs. Not used when running
tasks manually using plan_compaction
batch_size: Option<usize>The batch size to use when scanning the input fragments. If not
specified then the default (see
crate::dataset::Scanner::batch_size) will be used.
io_buffer_size: Option<u64>The number of bytes to allow to queue up in the I/O buffer when scanning
the input fragments. If not specified then the default (see
crate::dataset::Scanner::io_buffer_size) will be used.
Increasing this can avoid a deadlock that occurs when a single batch of data is larger than the I/O buffer size.
defer_index_remap: boolWhether to defer remapping indices during compaction. If true, indices will not be remapped during this compaction operation. Instead, the fragment reuse index is updated and will be used to perform remapping later.
index_remap_mode: IndexRemapModeHow the old-to-new row-address mapping used to remap indices is built.
Defaults to IndexRemapMode::Direct.
compaction_mode: Option<CompactionMode>The compaction mode to use. When set, this takes priority over the
deprecated enable_binary_copy and enable_binary_copy_force fields.
Defaults to None (falls back to legacy boolean fields).
enable_binary_copy: boolUse compaction_mode instead
Deprecated: use compaction_mode instead.
enable_binary_copy_force: boolUse compaction_mode instead
Deprecated: use compaction_mode instead.
binary_copy_read_batch_bytes: Option<usize>The batch size in bytes for reading during binary copy operations. Controls how much data is read at once when performing binary copy. Defaults to 16MB (16 * 1024 * 1024).
max_source_fragments: Option<usize>Maximum number of source fragments to compact in a single run. When set,
tasks are included in the plan until adding the next task would exceed
this limit. This allows for incremental compaction (e.g., compact 20
fragments at a time).
Defaults to None (no limit, all eligible fragments are compacted).
max_overlays_per_fragment: Option<usize>Maximum number of data overlay files a fragment may carry before it is
fully compacted. When set, any fragment with more than this many overlays
is rewritten into a fresh fragment with its overlays (and deletions)
materialized into the base data, dropping the fragment from any index
left stale by those overlays.
Defaults to Some(10). Set to Some(0) to compact every fragment that
carries any overlay, or None to disable the overlay-count trigger
entirely.
transaction_properties: Option<Arc<HashMap<String, String>>>Transaction properties to store with this commit.
These key-value pairs are stored in the transaction file and can be read later to identify the source of the commit (e.g., job_id for tracking completed compaction jobs).
Implementations§
Source§impl CompactionOptions
impl CompactionOptions
Sourcepub fn from_dataset_config(
config: &HashMap<String, String>,
) -> Result<CompactionOptions, Error>
pub fn from_dataset_config( config: &HashMap<String, String>, ) -> Result<CompactionOptions, Error>
Create CompactionOptions by starting with defaults and applying any
overrides found in the dataset manifest config.
Config keys are prefixed with lance.compaction. and map to fields:
lance.compaction.target_rows_per_fragmentlance.compaction.max_rows_per_grouplance.compaction.max_bytes_per_filelance.compaction.materialize_deletionslance.compaction.materialize_deletions_thresholdlance.compaction.defer_index_remaplance.compaction.index_remap_modelance.compaction.batch_sizelance.compaction.io_buffer_sizelance.compaction.compaction_modelance.compaction.binary_copy_read_batch_byteslance.compaction.max_source_fragmentslance.compaction.max_overlays_per_fragment
Sourcepub fn apply_dataset_config(
&mut self,
config: &HashMap<String, String>,
) -> Result<(), Error>
pub fn apply_dataset_config( &mut self, config: &HashMap<String, String>, ) -> Result<(), Error>
Apply overrides from the dataset manifest config to this options struct.
Only fields with corresponding config keys are modified; other fields retain their current values.
pub fn validate(&mut self)
Sourcepub fn compaction_mode(&self) -> CompactionMode
pub fn compaction_mode(&self) -> CompactionMode
Returns the effective CompactionMode, preferring the new
compaction_mode field and falling back to the deprecated boolean
fields for backwards compatibility.
Sourcepub fn transaction_properties(
self,
properties: HashMap<String, String>,
) -> CompactionOptions
pub fn transaction_properties( self, properties: HashMap<String, String>, ) -> CompactionOptions
Set transaction properties to store in the commit manifest.
Trait Implementations§
Source§impl Clone for CompactionOptions
impl Clone for CompactionOptions
Source§fn clone(&self) -> CompactionOptions
fn clone(&self) -> CompactionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompactionOptions
impl Debug for CompactionOptions
Source§impl Default for CompactionOptions
impl Default for CompactionOptions
Source§fn default() -> CompactionOptions
fn default() -> CompactionOptions
Source§impl<'de> Deserialize<'de> for CompactionOptions
impl<'de> Deserialize<'de> for CompactionOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CompactionOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CompactionOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CompactionOptions
impl PartialEq for CompactionOptions
Source§impl Serialize for CompactionOptions
impl Serialize for CompactionOptions
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 CompactionOptions
Auto Trait Implementations§
impl Freeze for CompactionOptions
impl RefUnwindSafe for CompactionOptions
impl Send for CompactionOptions
impl Sync for CompactionOptions
impl Unpin for CompactionOptions
impl UnsafeUnpin for CompactionOptions
impl UnwindSafe for CompactionOptions
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§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<E> ResultError for E
impl<T> ResultType for T
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.