pub struct CheckpointWriter { /* private fields */ }Expand description
Orchestrates the process of creating a checkpoint for a table.
The CheckpointWriter is the entry point for generating checkpoint data for a Delta table.
It automatically selects the appropriate checkpoint format (V1/V2) based on whether the table
supports the v2Checkpoints reader/writer feature.
§Warning
The checkpoint data must be fully written to storage before calling
CheckpointWriter::finalize. Failing to do so may result in data loss or corruption.
§See Also
See the module-level documentation for the complete checkpoint workflow
Implementations§
Source§impl CheckpointWriter
impl CheckpointWriter
Sourcepub fn checkpoint_path(&self) -> DeltaResult<Url>
pub fn checkpoint_path(&self) -> DeltaResult<Url>
Returns the URL where the checkpoint file should be written.
This method generates the checkpoint path based on the table’s root and the version of the underlying snapshot being checkpointed. The resulting path follows the classic Delta checkpoint naming convention (where the version is zero-padded to 20 digits):
<table_root>/<version>.checkpoint.parquet
For example, if the table root is s3://bucket/path and the version is 10,
the checkpoint path will be: s3://bucket/path/00000000000000000010.checkpoint.parquet
Sourcepub fn checkpoint_data(
&self,
engine: &dyn Engine,
) -> DeltaResult<ActionReconciliationIterator>
pub fn checkpoint_data( &self, engine: &dyn Engine, ) -> DeltaResult<ActionReconciliationIterator>
Returns the checkpoint data to be written to the checkpoint file.
This method reads actions from the log segment, processes them for checkpoint creation, and applies stats transforms based on table properties:
delta.checkpoint.writeStatsAsJson(default: true)delta.checkpoint.writeStatsAsStruct(default: false)
The returned ActionReconciliationIterator yields FilteredEngineData batches with
stats transforms already applied. Use ActionReconciliationIterator::state to get the
shared state for building a LastCheckpointHintStats after the iterator is exhausted.
§Engine Usage
let mut checkpoint_data = writer.checkpoint_data(&engine)?;
let state = checkpoint_data.state();
while let Some(batch) = checkpoint_data.next() {
let data = batch?.apply_selection_vector()?;
parquet_writer.write(&data).await?;
}
drop(checkpoint_data);
let state = Arc::into_inner(state)
.ok_or(Error::internal_error("checkpoint state Arc still has other references"))?;
let last_checkpoint_stats =
LastCheckpointHintStats::from_reconciliation_state(state, size_in_bytes, 0)?;
writer.finalize(&engine, &last_checkpoint_stats)?;Sourcepub fn finalize(
self,
engine: &dyn Engine,
last_checkpoint_stats: &LastCheckpointHintStats,
) -> DeltaResult<()>
pub fn finalize( self, engine: &dyn Engine, last_checkpoint_stats: &LastCheckpointHintStats, ) -> DeltaResult<()>
Finalizes checkpoint creation by saving metadata about the checkpoint.
§Important
This method must be called only after:
- The checkpoint data iterator has been fully exhausted
- All data has been successfully written to object storage
§Parameters
engine: Implementation ofEngineAPIs.last_checkpoint_stats: TheLastCheckpointHintStatscontaining fields needed to write the_last_checkpointfile.
§Returns: Ok if the checkpoint was successfully finalized
Trait Implementations§
Source§impl Clone for CheckpointWriter
impl Clone for CheckpointWriter
Source§fn clone(&self) -> CheckpointWriter
fn clone(&self) -> CheckpointWriter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CheckpointWriter
impl !UnwindSafe for CheckpointWriter
impl Freeze for CheckpointWriter
impl Send for CheckpointWriter
impl Sync for CheckpointWriter
impl Unpin for CheckpointWriter
impl UnsafeUnpin for CheckpointWriter
Blanket Implementations§
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
dyn Any reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ
fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ
Arc<dyn Any> reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
Box<dyn Any>: Read moreSource§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
std::any::type_name, since Any does not provide it and
Any::type_id is useless as a debugging aid (its Debug is just a mess of hex digits).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,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
Source§fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.Source§impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
Source§fn try_into_kernel(self) -> Result<KernelType, ArrowError>
fn try_into_kernel(self) -> Result<KernelType, ArrowError>
arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.