pub struct DeltaTable {
pub state: Option<DeltaTableState>,
pub config: DeltaTableConfig,
/* private fields */
}
Expand description
In memory representation of a Delta Table
Fields§
§state: Option<DeltaTableState>
The state of the table as of the most recent loaded Delta log entry.
config: DeltaTableConfig
the load options used during load
Implementations§
Source§impl DeltaTable
impl DeltaTable
Sourcepub fn new(log_store: LogStoreRef, config: DeltaTableConfig) -> Self
pub fn new(log_store: LogStoreRef, config: DeltaTableConfig) -> Self
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) -> ObjectStoreRef
pub fn object_store(&self) -> ObjectStoreRef
get a shared reference to the delta object store
Sourcepub async fn verify_deltatable_existence(&self) -> DeltaResult<bool>
pub async fn verify_deltatable_existence(&self) -> DeltaResult<bool>
Check if the DeltaTable
exists
Sourcepub fn log_store(&self) -> LogStoreRef
pub fn log_store(&self) -> LogStoreRef
get a shared reference to the log store
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 async fn get_earliest_version(&self) -> Result<i64, DeltaTableError>
pub async fn get_earliest_version(&self) -> Result<i64, DeltaTableError>
returns the earliest available version of the table
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 peek_next_commit(
&self,
current_version: i64,
) -> Result<PeekCommit, DeltaTableError>
pub async fn peek_next_commit( &self, current_version: i64, ) -> Result<PeekCommit, DeltaTableError>
Get the list of actions for the next commit
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<Vec<CommitInfo>, DeltaTableError>
pub async fn history( &self, limit: Option<usize>, ) -> Result<Vec<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<'a>(
&'a self,
filters: &'a [PartitionFilter],
) -> Result<impl Iterator<Item = DeltaResult<LogicalFile<'a>>>, DeltaTableError>
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
Sourcepub fn get_files_by_partitions(
&self,
filters: &[PartitionFilter],
) -> Result<Vec<Path>, DeltaTableError>
pub fn get_files_by_partitions( &self, filters: &[PartitionFilter], ) -> Result<Vec<Path>, DeltaTableError>
Returns the file list tracked in current table state filtered by provided
PartitionFilter
s.
Sourcepub fn get_file_uris_by_partitions(
&self,
filters: &[PartitionFilter],
) -> Result<Vec<String>, DeltaTableError>
pub 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_files_iter(&self) -> DeltaResult<impl Iterator<Item = Path> + '_>
pub fn get_files_iter(&self) -> DeltaResult<impl Iterator<Item = Path> + '_>
Returns an iterator of file names present in the loaded state
Sourcepub fn get_file_uris(&self) -> DeltaResult<impl Iterator<Item = String> + '_>
pub fn get_file_uris(&self) -> DeltaResult<impl Iterator<Item = String> + '_>
Returns a URIs for all active files present in the current table version.
Sourcepub fn get_files_count(&self) -> usize
pub fn get_files_count(&self) -> usize
Get the number of files in the table - returns 0 if no metadata is loaded
Sourcepub fn snapshot(&self) -> DeltaResult<&DeltaTableState>
pub fn snapshot(&self) -> DeltaResult<&DeltaTableState>
Returns the currently loaded state snapshot.
Sourcepub fn protocol(&self) -> DeltaResult<&Protocol>
pub fn protocol(&self) -> DeltaResult<&Protocol>
Returns current table protocol
Sourcepub fn metadata(&self) -> Result<&Metadata, DeltaTableError>
pub fn metadata(&self) -> Result<&Metadata, DeltaTableError>
Returns the metadata associated with the loaded state.
Sourcepub fn get_app_transaction_version(&self) -> HashMap<String, Transaction>
pub fn get_app_transaction_version(&self) -> HashMap<String, Transaction>
Returns the current version of the DeltaTable based on the loaded metadata.
Sourcepub fn schema(&self) -> Option<&StructType>
pub fn schema(&self) -> Option<&StructType>
Return table schema parsed from transaction log. Return None if table hasn’t been loaded or no metadata was found in the log.
Sourcepub fn get_schema(&self) -> Result<&StructType, DeltaTableError>
pub fn get_schema(&self) -> Result<&StructType, DeltaTableError>
Return table schema parsed from transaction log. Return DeltaTableError
if table hasn’t
been loaded or no metadata was found in the log.
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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::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§impl From<DeltaTable> for DeltaOps
impl From<DeltaTable> for DeltaOps
Source§fn from(table: DeltaTable) -> Self
fn from(table: DeltaTable) -> Self
Source§impl Serialize for DeltaTable
impl Serialize for DeltaTable
Source§impl TableProvider for DeltaTable
impl TableProvider for DeltaTable
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Any
so that it can be
downcast to a specific implementation.Source§fn schema(&self) -> Arc<ArrowSchema>
fn schema(&self) -> Arc<ArrowSchema>
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 = DataFusionResult<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: '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 = DataFusionResult<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: '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],
) -> DataFusionResult<Vec<TableProviderFilterPushDown>>
fn supports_filters_pushdown( &self, filter: &[&Expr], ) -> DataFusionResult<Vec<TableProviderFilterPushDown>>
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> 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 more