Skip to main content

CheckpointWriter

Struct CheckpointWriter 

Source
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

Source

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

Source

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)?;
Source

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:

  1. The checkpoint data iterator has been fully exhausted
  2. All data has been successfully written to object storage
§Parameters
  • engine: Implementation of Engine APIs.
  • last_checkpoint_stats: The LastCheckpointHintStats containing fields needed to write the _last_checkpoint file.
§Returns: Ok if the checkpoint was successfully finalized

Trait Implementations§

Source§

impl Clone for CheckpointWriter

Source§

fn clone(&self) -> CheckpointWriter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CheckpointWriter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any + Send + Sync,

Source§

fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)

Obtains a dyn Any reference to the object: Read more
Source§

fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Obtains an Arc<dyn Any> reference to the object: Read more
Source§

fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts the object to Box<dyn Any>: Read more
Source§

fn type_name(&self) -> &'static str

Convenient wrapper for 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> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelType
where ArrowType: TryFromKernel<KernelType>,

Source§

fn try_into_arrow(self) -> Result<ArrowType, ArrowError>

Available on crate feature arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.
Source§

impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowType
where KernelType: TryFromArrow<ArrowType>,

Source§

fn try_into_kernel(self) -> Result<KernelType, ArrowError>

Available on crate feature arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more