pub struct DeltaTable {
pub state: Option<DeltaTableState>,
pub config: DeltaTableConfig,
/* private fields */
}Expand description
In memory representation of a Delta Table
A DeltaTable is a purely logical concept that represents a dataset that can ewvolve over time. To attain concrete information about a table a snapshot need to be loaded. Most commonly this is the latest state of the tablem but may also loaded for a specific version or point in time.
Fields§
§state: Option<DeltaTableState>The state of the table as of the most recent loaded Delta log entry.
config: DeltaTableConfigthe load options used during load
Implementations§
Source§impl DeltaTable
impl DeltaTable
Sourcepub fn new(log_store: Arc<dyn LogStore>, config: DeltaTableConfig) -> DeltaTable
pub fn new(log_store: Arc<dyn LogStore>, config: DeltaTableConfig) -> DeltaTable
Create a new Delta Table struct without loading any data from backing storage.
NOTE: This is for advanced users. If you don’t know why you need to use this method, please
call one of the open_table helper methods instead.
Sourcepub fn object_store(&self) -> Arc<dyn ObjectStore>
pub fn object_store(&self) -> Arc<dyn ObjectStore>
get a shared reference to the delta object store
Sourcepub async fn verify_deltatable_existence(&self) -> Result<bool, DeltaTableError>
pub async fn verify_deltatable_existence(&self) -> Result<bool, DeltaTableError>
Check if the DeltaTable exists
Sourcepub async fn get_latest_version(&self) -> Result<i64, DeltaTableError>
pub async fn get_latest_version(&self) -> Result<i64, DeltaTableError>
returns the latest available version of the table
Sourcepub fn version(&self) -> Option<i64>
pub fn version(&self) -> Option<i64>
Currently loaded version of the table - if any.
This will return the latest version of the table if it has been loaded.
Returns None if the table has not been loaded.
Sourcepub async fn load(&mut self) -> Result<(), DeltaTableError>
pub async fn load(&mut self) -> Result<(), DeltaTableError>
Load DeltaTable with data from latest checkpoint
Sourcepub async fn update(&mut self) -> Result<(), DeltaTableError>
pub async fn update(&mut self) -> Result<(), DeltaTableError>
Updates the DeltaTable to the most recent state committed to the transaction log by loading the last checkpoint and incrementally applying each version since.
Sourcepub async fn update_incremental(
&mut self,
max_version: Option<i64>,
) -> Result<(), DeltaTableError>
pub async fn update_incremental( &mut self, max_version: Option<i64>, ) -> Result<(), DeltaTableError>
Updates the DeltaTable to the latest version by incrementally applying newer versions.
It assumes that the table is already updated to the current version self.version.
Sourcepub async fn load_version(
&mut self,
version: i64,
) -> Result<(), DeltaTableError>
pub async fn load_version( &mut self, version: i64, ) -> Result<(), DeltaTableError>
Loads the DeltaTable state for the given version.
Sourcepub async fn history(
&self,
limit: Option<usize>,
) -> Result<impl Iterator<Item = CommitInfo>, DeltaTableError>
pub async fn history( &self, limit: Option<usize>, ) -> Result<impl Iterator<Item = CommitInfo>, DeltaTableError>
Returns provenance information, including the operation, user, and so on, for each write to a table.
The table history retention is based on the logRetentionDuration property of the Delta Table, 30 days by default.
If limit is given, this returns the information of the latest limit commits made to this table. Otherwise,
it returns all commits from the earliest commit.
Sourcepub fn get_active_add_actions_by_partitions(
&self,
filters: &[PartitionFilter],
) -> Pin<Box<dyn Stream<Item = Result<LogicalFileView, DeltaTableError>> + Send + '_>>
pub fn get_active_add_actions_by_partitions( &self, filters: &[PartitionFilter], ) -> Pin<Box<dyn Stream<Item = Result<LogicalFileView, DeltaTableError>> + Send + '_>>
Stream all logical files matching the provided PartitionFilters.
Sourcepub async fn get_files_by_partitions(
&self,
filters: &[PartitionFilter],
) -> Result<Vec<Path>, DeltaTableError>
pub async fn get_files_by_partitions( &self, filters: &[PartitionFilter], ) -> Result<Vec<Path>, DeltaTableError>
Returns the file list tracked in current table state filtered by provided
PartitionFilters.
Sourcepub async fn get_file_uris_by_partitions(
&self,
filters: &[PartitionFilter],
) -> Result<Vec<String>, DeltaTableError>
pub async fn get_file_uris_by_partitions( &self, filters: &[PartitionFilter], ) -> Result<Vec<String>, DeltaTableError>
Return the file uris as strings for the partition(s)
Sourcepub fn get_file_uris(
&self,
) -> Result<impl Iterator<Item = String>, DeltaTableError>
pub fn get_file_uris( &self, ) -> Result<impl Iterator<Item = String>, DeltaTableError>
Returns a URIs for all active files present in the current table version.
Sourcepub fn snapshot(&self) -> Result<&DeltaTableState, DeltaTableError>
pub fn snapshot(&self) -> Result<&DeltaTableState, DeltaTableError>
Returns the currently loaded state snapshot.
This method provides access to the currently loaded state of the Delta table.
§Returns
A reference to the current state of the Delta table.
§Errors
Returns NotInitialized if the table has not been initialized.
Sourcepub async fn load_with_datetime(
&mut self,
datetime: DateTime<Utc>,
) -> Result<(), DeltaTableError>
pub async fn load_with_datetime( &mut self, datetime: DateTime<Utc>, ) -> Result<(), DeltaTableError>
Time travel Delta table to the latest version that’s created at or before provided
datetime argument.
Internally, this methods performs a binary search on all Delta transaction logs.
Trait Implementations§
Source§impl AsRef<DeltaTable> for DeltaOps
impl AsRef<DeltaTable> for DeltaOps
Source§fn as_ref(&self) -> &DeltaTable
fn as_ref(&self) -> &DeltaTable
Source§impl Clone for DeltaTable
impl Clone for DeltaTable
Source§fn clone(&self) -> DeltaTable
fn clone(&self) -> DeltaTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeltaTable
impl Debug for DeltaTable
Source§impl<'de> Deserialize<'de> for DeltaTable
impl<'de> Deserialize<'de> for DeltaTable
Source§fn deserialize<D>(
deserializer: D,
) -> Result<DeltaTable, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<DeltaTable, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for DeltaTable
impl Display for DeltaTable
Source§impl From<DeltaOps> for DeltaTable
impl From<DeltaOps> for DeltaTable
Source§fn from(ops: DeltaOps) -> DeltaTable
fn from(ops: DeltaOps) -> DeltaTable
Source§impl From<DeltaTable> for DeltaOps
impl From<DeltaTable> for DeltaOps
Source§fn from(table: DeltaTable) -> DeltaOps
fn from(table: DeltaTable) -> DeltaOps
Source§impl Serialize for DeltaTable
impl Serialize for DeltaTable
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,
Source§impl TableProvider for DeltaTable
impl TableProvider for DeltaTable
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any so that it can be
downcast to a specific implementation.Source§fn table_type(&self) -> TableType
fn table_type(&self) -> TableType
Source§fn get_table_definition(&self) -> Option<&str>
fn get_table_definition(&self) -> Option<&str>
Source§fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
LogicalPlan of this table, if available.Source§fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
DeltaTable: 'async_trait,
fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
DeltaTable: 'async_trait,
ExecutionPlan for scanning the table with optionally
specified projection, filter and limit, described below. Read moreSource§fn supports_filters_pushdown(
&self,
filter: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>, DataFusionError>
fn supports_filters_pushdown( &self, filter: &[&Expr], ) -> Result<Vec<TableProviderFilterPushDown>, DataFusionError>
Source§fn statistics(&self) -> Option<Statistics>
fn statistics(&self) -> Option<Statistics>
Source§fn constraints(&self) -> Option<&Constraints>
fn constraints(&self) -> Option<&Constraints>
Source§fn get_column_default(&self, _column: &str) -> Option<&Expr>
fn get_column_default(&self, _column: &str) -> Option<&Expr>
Source§fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_input: Arc<dyn ExecutionPlan>,
_insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_input: Arc<dyn ExecutionPlan>,
_insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
ExecutionPlan to insert data into this table, if
supported. Read moreAuto Trait Implementations§
impl Freeze for DeltaTable
impl !RefUnwindSafe for DeltaTable
impl Send for DeltaTable
impl Sync for DeltaTable
impl Unpin for DeltaTable
impl !UnwindSafe for DeltaTable
Blanket Implementations§
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
dyn Any reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
Arc<dyn Any> reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.