deltalake_core::table::state

Struct DeltaTableState

Source
pub struct DeltaTableState { /* private fields */ }
Expand description

State snapshot currently held by the Delta Table instance.

Implementations§

Source§

impl DeltaTableState

Source

pub async fn try_new( table_root: &Path, store: Arc<dyn ObjectStore>, config: DeltaTableConfig, version: Option<i64>, ) -> DeltaResult<Self>

Create a new DeltaTableState

Source

pub fn version(&self) -> i64

Return table version

Source

pub fn version_timestamp(&self, version: i64) -> Option<i64>

Get the timestamp when a version commit was created. This is the timestamp of the commit file. If the commit file is not present, None is returned.

Source

pub fn log_data(&self) -> LogDataHandler<'_>

Returns a semantic accessor to the currently loaded log data.

Source

pub async fn all_tombstones( &self, store: Arc<dyn ObjectStore>, ) -> DeltaResult<impl Iterator<Item = Remove>>

Full list of tombstones (remove actions) representing files removed from table state).

Source

pub async fn unexpired_tombstones( &self, store: Arc<dyn ObjectStore>, ) -> DeltaResult<impl Iterator<Item = Remove>>

List of unexpired tombstones (remove actions) representing files removed from table state. The retention period is set by deletedFileRetentionDuration with default value of 1 week.

Source

pub fn file_actions(&self) -> DeltaResult<Vec<Add>>

Full list of add actions representing all parquet files that are part of the current delta table state.

Source

pub fn file_actions_iter(&self) -> DeltaResult<impl Iterator<Item = Add> + '_>

Full list of add actions representing all parquet files that are part of the current delta table state.

Source

pub fn files_count(&self) -> usize

Get the number of files in the current table state

Source

pub fn cdc_files(&self) -> DeltaResult<impl Iterator<Item = AddCDCFile> + '_>

Full list of all of the CDC files added as part of the changeDataFeed feature

Source

pub fn file_paths_iter(&self) -> impl Iterator<Item = Path> + '_

Returns an iterator of file names present in the loaded state

Source

pub fn app_transaction_version( &self, ) -> DeltaResult<impl Iterator<Item = Transaction> + '_>

HashMap containing the last transaction stored for every application.

Source

pub fn protocol(&self) -> &Protocol

The most recent protocol of the table.

Source

pub fn metadata(&self) -> &Metadata

The most recent metadata of the table.

Source

pub fn schema(&self) -> &StructType

The table schema

Source

pub fn load_config(&self) -> &DeltaTableConfig

Get the table config which is loaded with of the snapshot

Source

pub fn table_config(&self) -> TableConfig<'_>

Well known table configuration

Source

pub fn snapshot(&self) -> &EagerSnapshot

Obtain the Eager snapshot of the state

Source

pub async fn update( &mut self, log_store: Arc<dyn LogStore>, version: Option<i64>, ) -> Result<(), DeltaTableError>

Update the state of the table to the given version.

Source

pub fn get_active_add_actions_by_partitions<'a>( &'a self, filters: &'a [PartitionFilter], ) -> Result<impl Iterator<Item = DeltaResult<LogicalFile<'a>>>, DeltaTableError>

Obtain Add actions for files that match the filter

Source§

impl DeltaTableState

Source

pub fn add_actions_table( &self, flatten: bool, ) -> Result<RecordBatch, DeltaTableError>

Get an arrow::record_batch::RecordBatch containing add action data.

§Arguments
  • flatten - whether to flatten the schema. Partition values columns are given the prefix partition., statistics (null_count, min, and max) are given the prefix null_count., min., and max., and tags the prefix tags.. Nested field names are concatenated with ..
§Data schema

Each row represents a file that is a part of the selected tables state.

  • path (String): relative or absolute to a file.
  • size_bytes (Int64): size of file in bytes.
  • modification_time (Millisecond Timestamp): time the file was created.
  • data_change (Boolean): false if data represents data moved from other files in the same transaction.
  • partition.{partition column name} (matches column type): value of partition the file corresponds to.
  • null_count.{col_name} (Int64): number of null values for column in this file.
  • min.{col_name} (matches column type): minimum value of column in file (if available).
  • max.{col_name} (matches column type): maximum value of column in file (if available).
  • tag.{tag_key} (String): value of a metadata tag for the file.
Source§

impl DeltaTableState

Source

pub fn datafusion_table_statistics(&self) -> Option<Statistics>

Provide table level statistics to Datafusion

Trait Implementations§

Source§

impl Clone for DeltaTableState

Source§

fn clone(&self) -> DeltaTableState

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl DataFusionMixins for DeltaTableState

Source§

fn arrow_schema(&self) -> DeltaResult<ArrowSchemaRef>

The physical datafusion schema of a table
Source§

fn input_schema(&self) -> DeltaResult<ArrowSchemaRef>

Get the table schema as an ArrowSchemaRef
Source§

fn parse_predicate_expression( &self, expr: impl AsRef<str>, df_state: &SessionState, ) -> DeltaResult<Expr>

Parse an expression string into a datafusion Expr
Source§

impl Debug for DeltaTableState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DeltaTableState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PruningStatistics for DeltaTableState

Source§

fn min_values(&self, column: &Column) -> Option<ArrayRef>

Return the minimum values for the named column, if known. Read more
Source§

fn max_values(&self, column: &Column) -> Option<ArrayRef>

Return the maximum values for the named column, if known. Read more
Source§

fn num_containers(&self) -> usize

Return the number of containers (e.g. Row Groups) being pruned with these statistics. Read more
Source§

fn null_counts(&self, column: &Column) -> Option<ArrayRef>

Return the number of null values for the named column as an UInt64Array Read more
Source§

fn row_counts(&self, column: &Column) -> Option<ArrayRef>

Return the number of rows for the named column in each container as an UInt64Array. Read more
Source§

fn contained( &self, column: &Column, values: &HashSet<ScalarValue>, ) -> Option<BooleanArray>

Returns BooleanArray where each row represents information known about specific literal values in a column. Read more
Source§

impl Serialize for DeltaTableState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TableReference for DeltaTableState

Source§

fn config(&self) -> TableConfig<'_>

Well known table configuration
Source§

fn protocol(&self) -> &Protocol

Get the table protocol of the snapshot
Source§

fn metadata(&self) -> &Metadata

Get the table metadata of the snapshot
Source§

fn eager_snapshot(&self) -> &EagerSnapshot

Try to cast this table reference to a EagerSnapshot

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> 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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<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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T