Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions crates/core/src/logstore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,10 @@ pub(crate) mod tests {
.await
.expect("Failed to write log file");

let table_uri = "memory:///delta-table";

let table = crate::DeltaTableBuilder::from_valid_uri(table_uri)
let table_uri = url::Url::parse("memory:///delta-table").unwrap();
let table = crate::DeltaTableBuilder::from_uri(table_uri.clone())
.unwrap()
.with_storage_backend(memory_store, Url::parse(table_uri).unwrap())
.with_storage_backend(memory_store, table_uri)
.build()?;

let result = table.log_store().peek_next_commit(0).await;
Expand Down
10 changes: 6 additions & 4 deletions crates/core/src/operations/vacuum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,10 @@ mod tests {
.unwrap();
}

let mut table = crate::DeltaTableBuilder::from_valid_uri("memory:///")
let table_url = url::Url::parse("memory:///").unwrap();
let mut table = crate::DeltaTableBuilder::from_uri(table_url.clone())
.unwrap()
.with_storage_backend(Arc::new(store), url::Url::parse("memory:///").unwrap())
.with_storage_backend(Arc::new(store), table_url)
.build()
.unwrap();
table.load().await.unwrap();
Expand Down Expand Up @@ -874,9 +875,10 @@ mod tests {
.await
.unwrap();

let mut table = crate::DeltaTableBuilder::from_valid_uri("memory:///")
let table_url = url::Url::parse("memory:///").unwrap();
let mut table = crate::DeltaTableBuilder::from_uri(table_url.clone())
.unwrap()
.with_storage_backend(Arc::new(store), url::Url::parse("memory:///").unwrap())
.with_storage_backend(Arc::new(store), table_url)
.build()
.unwrap();
table.load().await.unwrap();
Expand Down
56 changes: 0 additions & 56 deletions crates/core/src/table/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,55 +121,6 @@ impl DeltaTableBuilder {
})
}

/// Creates `DeltaTableBuilder` from table uri string (deprecated)
///
/// Can panic on an invalid URI
///
/// ```rust
/// # use deltalake_core::table::builder::*;
/// let builder = DeltaTableBuilder::from_uri_str("../test/tests/data/delta-0.8.0");
/// assert!(true);
/// ```
#[deprecated(note = "Use from_uri with url::Url instead")]
pub fn from_uri_str(table_uri: impl AsRef<str>) -> Self {
let url = ensure_table_uri(&table_uri).expect("The specified table_uri is not valid");
DeltaTableBuilder::from_uri(url).expect("Failed to create valid builder")
}

/// Creates `DeltaTableBuilder` from verified table uri string (deprecated).
///
/// ```rust
/// # use deltalake_core::table::builder::*;
/// let builder = DeltaTableBuilder::from_valid_uri("memory:///");
/// assert!(builder.is_ok(), "Builder failed with {builder:?}");
/// ```
#[deprecated(note = "Use from_uri with url::Url instead")]
pub fn from_valid_uri(table_uri: impl AsRef<str>) -> DeltaResult<Self> {
if let Ok(url) = Url::parse(table_uri.as_ref()) {
if url.scheme() == "file" {
let path = url.to_file_path().map_err(|_| {
DeltaTableError::InvalidTableLocation(table_uri.as_ref().to_string())
})?;
ensure_file_location_exists(path)?;
}
} else {
let expanded_path = expand_tilde_path(table_uri.as_ref())?;
ensure_file_location_exists(expanded_path)?;
}

let url = ensure_table_uri(&table_uri)?;
debug!("creating table builder with {url}");

Ok(Self {
table_uri: url.into(),
storage_backend: None,
version: DeltaVersion::default(),
storage_options: None,
allow_http: None,
table_config: DeltaTableConfig::default(),
})
}

/// Sets `require_files=false` to the builder
pub fn without_files(mut self) -> Self {
self.table_config.require_files = false;
Expand Down Expand Up @@ -610,13 +561,6 @@ mod tests {
assert_eq!(expected.as_str().trim_end_matches('/'), url.as_str());
}

#[test]
fn test_invalid_uri() {
// Urls should round trips as-is
DeltaTableBuilder::from_valid_uri("this://is.nonsense")
.expect_err("this should be an error");
}

#[test]
fn test_writer_storage_opts_url_trim() {
let cases = [
Expand Down
18 changes: 1 addition & 17 deletions crates/core/src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};

use self::builder::DeltaTableConfig;
use self::state::DeltaTableState;
use crate::kernel::{CommitInfo, DataCheck, LogicalFileView, Metadata, Protocol};
use crate::kernel::{CommitInfo, DataCheck, LogicalFileView};
use crate::logstore::{
commit_uri_from_version, extract_version_from_filename, LogStoreConfig, LogStoreExt,
LogStoreRef, ObjectStoreRef,
Expand Down Expand Up @@ -323,22 +323,6 @@ impl DeltaTable {
self.state.as_ref().ok_or(DeltaTableError::NotInitialized)
}

/// Returns current table protocol
#[deprecated(since = "0.27.1", note = "Use `snapshot()?.protocol()` instead")]
pub fn protocol(&self) -> DeltaResult<&Protocol> {
Ok(self
.state
.as_ref()
.ok_or(DeltaTableError::NotInitialized)?
.protocol())
}

/// Returns the metadata associated with the loaded state.
#[deprecated(since = "0.27.1", note = "Use `snapshot()?.metadata()` instead")]
pub fn metadata(&self) -> Result<&Metadata, DeltaTableError> {
Ok(self.snapshot()?.metadata())
}

/// Time travel Delta table to the latest version that's created at or before provided
/// `datetime` argument.
///
Expand Down
24 changes: 1 addition & 23 deletions crates/core/src/table/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use std::sync::Arc;

use arrow::compute::concat_batches;
use chrono::Utc;
use delta_kernel::engine::arrow_conversion::TryIntoKernel;
use delta_kernel::expressions::column_expr_ref;
use delta_kernel::schema::{SchemaRef as KernelSchemaRef, StructField};
use delta_kernel::table_properties::TableProperties;
use delta_kernel::{EvaluationHandler, Expression};
use futures::stream::BoxStream;
use futures::{future::ready, StreamExt as _, TryStreamExt as _};
use futures::{StreamExt as _, TryStreamExt as _};
use object_store::path::Path;
use serde::{Deserialize, Serialize};

Expand All @@ -24,7 +23,6 @@ use crate::kernel::{
};
use crate::logstore::LogStore;
use crate::partitions::PartitionFilter;
use crate::table::config::TablePropertiesExt;
use crate::{DeltaResult, DeltaTableError};

/// State snapshot currently held by the Delta Table instance.
Expand Down Expand Up @@ -140,26 +138,6 @@ impl DeltaTableState {
self.snapshot.snapshot().tombstones(log_store)
}

/// 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.
#[deprecated(
since = "0.29.0",
note = "Use `all_tombstones` instead and filter by retention timestamp."
)]
pub fn unexpired_tombstones(
&self,
log_store: &dyn LogStore,
) -> BoxStream<'_, DeltaResult<TombstoneView>> {
let retention_timestamp = Utc::now().timestamp_millis()
- self
.table_config()
.deleted_file_retention_duration()
.as_millis() as i64;
self.all_tombstones(log_store)
.try_filter(move |t| ready(t.deletion_timestamp().unwrap_or(0) > retention_timestamp))
.boxed()
}

/// Full list of add actions representing all parquet files that are part of the current
/// delta table state.
pub async fn file_actions(&self, log_store: &dyn LogStore) -> DeltaResult<Vec<Add>> {
Expand Down
Loading