Skip to content

Commit

Permalink
chore: rename DeltaConfigKey to TableProperty to be more clear on its…
Browse files Browse the repository at this point in the history
… purpose

This also necessitates a version bump of all the crates!
  • Loading branch information
rtyler committed Sep 17, 2024
1 parent 7022861 commit e5fd2bc
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 92 deletions.
4 changes: 2 additions & 2 deletions crates/aws/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltalake-aws"
version = "0.2.1"
version = "0.3.0"
authors.workspace = true
keywords.workspace = true
readme.workspace = true
Expand All @@ -12,7 +12,7 @@ repository.workspace = true
rust-version.workspace = true

[dependencies]
deltalake-core = { version = "0.19.1", path = "../core" }
deltalake-core = { version = "0.20.0", path = "../core" }
aws-smithy-runtime-api = { version="1.7" }
aws-smithy-runtime = { version="1.7", optional = true}
aws-credential-types = { version="1.2", features = ["hardcoded-credentials"]}
Expand Down
4 changes: 2 additions & 2 deletions crates/azure/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltalake-azure"
version = "0.2.0"
version = "0.3.0"
authors.workspace = true
keywords.workspace = true
readme.workspace = true
Expand All @@ -12,7 +12,7 @@ repository.workspace = true
rust-version.workspace = true

[dependencies]
deltalake-core = { version = "0.19.1", path = "../core" }
deltalake-core = { version = "0.20.0", path = "../core" }
lazy_static = "1"

# workspace depenndecies
Expand Down
4 changes: 2 additions & 2 deletions crates/catalog-glue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltalake-catalog-glue"
version = "0.3.0"
version = "0.4.0"
authors.workspace = true
keywords.workspace = true
readme.workspace = true
Expand All @@ -15,7 +15,7 @@ rust-version.workspace = true
async-trait = { workspace = true }
aws-config = "1"
aws-sdk-glue = "1"
deltalake-core = { version = "0.19.1", path = "../core" }
deltalake-core = { version = "0.20.0", path = "../core" }
thiserror = { workspace = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltalake-core"
version = "0.19.1"
version = "0.20.0"
authors.workspace = true
keywords.workspace = true
readme.workspace = true
Expand Down
14 changes: 7 additions & 7 deletions crates/core/src/kernel/models/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use url::Url;

use super::schema::StructType;
use crate::kernel::{error::Error, DeltaResult};
use crate::DeltaConfigKey;
use crate::TableProperty;

/// Defines a file format used in table
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -240,10 +240,10 @@ impl Protocol {
new_properties: &HashMap<String, String>,
raise_if_not_exists: bool,
) -> DeltaResult<Protocol> {
let mut parsed_properties: HashMap<DeltaConfigKey, String> = HashMap::new();
let mut parsed_properties: HashMap<TableProperty, String> = HashMap::new();

for (key, value) in new_properties {
if let Ok(parsed_key) = key.parse::<DeltaConfigKey>() {
if let Ok(parsed_key) = key.parse::<TableProperty>() {
parsed_properties.insert(parsed_key, value.to_string());
} else if raise_if_not_exists {
return Err(Error::Generic(format!(
Expand All @@ -254,7 +254,7 @@ impl Protocol {
}

// Check and update delta.minReaderVersion
if let Some(min_reader_version) = parsed_properties.get(&DeltaConfigKey::MinReaderVersion) {
if let Some(min_reader_version) = parsed_properties.get(&TableProperty::MinReaderVersion) {
let new_min_reader_version = min_reader_version.parse::<i32>();
match new_min_reader_version {
Ok(version) => match version {
Expand All @@ -280,7 +280,7 @@ impl Protocol {
}

// Check and update delta.minWriterVersion
if let Some(min_writer_version) = parsed_properties.get(&DeltaConfigKey::MinWriterVersion) {
if let Some(min_writer_version) = parsed_properties.get(&TableProperty::MinWriterVersion) {
let new_min_writer_version = min_writer_version.parse::<i32>();
match new_min_writer_version {
Ok(version) => match version {
Expand All @@ -306,7 +306,7 @@ impl Protocol {
}

// Check enableChangeDataFeed and bump protocol or add writerFeature if writer versions is >=7
if let Some(enable_cdf) = parsed_properties.get(&DeltaConfigKey::EnableChangeDataFeed) {
if let Some(enable_cdf) = parsed_properties.get(&TableProperty::EnableChangeDataFeed) {
let if_enable_cdf = enable_cdf.to_ascii_lowercase().parse::<bool>();
match if_enable_cdf {
Ok(true) => {
Expand Down Expand Up @@ -335,7 +335,7 @@ impl Protocol {
}
}

if let Some(enable_dv) = parsed_properties.get(&DeltaConfigKey::EnableDeletionVectors) {
if let Some(enable_dv) = parsed_properties.get(&TableProperty::EnableDeletionVectors) {
let if_enable_dv = enable_dv.to_ascii_lowercase().parse::<bool>();
match if_enable_dv {
Ok(true) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub use self::errors::*;
pub use self::schema::partitions::*;
pub use self::schema::*;
pub use self::table::builder::{DeltaTableBuilder, DeltaTableConfig, DeltaVersion};
pub use self::table::config::DeltaConfigKey;
pub use self::table::config::TableProperty;
pub use self::table::DeltaTable;
pub use object_store::{path::Path, Error as ObjectStoreError, ObjectMeta, ObjectStore};
pub use operations::DeltaOps;
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/operations/cdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod tests {
use crate::kernel::DataType as DeltaDataType;
use crate::kernel::{Action, PrimitiveType, Protocol};
use crate::operations::DeltaOps;
use crate::{DeltaConfigKey, DeltaTable};
use crate::{DeltaTable, TableProperty};
use arrow::array::{ArrayRef, Int32Array, StructArray};
use arrow::datatypes::{DataType, Field};
use arrow_array::RecordBatch;
Expand Down Expand Up @@ -130,7 +130,7 @@ mod tests {
None,
)
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.expect("failed to make a version 4 table with EnableChangeDataFeed");
table.load().await.expect("Failed to reload table");
Expand Down Expand Up @@ -185,7 +185,7 @@ mod tests {
None,
)
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.expect("failed to make a version 4 table with EnableChangeDataFeed");
table.load().await.expect("Failed to reload table");
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/operations/convert_to_delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
operations::create::CreateBuilder,
protocol::SaveMode,
table::builder::ensure_table_uri,
table::config::DeltaConfigKey,
table::config::TableProperty,
writer::stats::stats_from_parquet_metadata,
DeltaResult, DeltaTable, DeltaTableError, ObjectStoreError, NULL_PARTITION_VALUE_DATA_PATH,
};
Expand Down Expand Up @@ -212,7 +212,7 @@ impl ConvertToDeltaBuilder {
/// Specify a table property in the table configuration
pub fn with_configuration_property(
mut self,
key: DeltaConfigKey,
key: TableProperty,
value: Option<impl Into<String>>,
) -> Self {
self.configuration
Expand Down
12 changes: 6 additions & 6 deletions crates/core/src/operations/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::kernel::{
use crate::logstore::{LogStore, LogStoreRef};
use crate::protocol::{DeltaOperation, SaveMode};
use crate::table::builder::ensure_table_uri;
use crate::table::config::DeltaConfigKey;
use crate::table::config::TableProperty;
use crate::{DeltaTable, DeltaTableBuilder};

#[derive(thiserror::Error, Debug)]
Expand Down Expand Up @@ -193,7 +193,7 @@ impl CreateBuilder {
/// Specify a table property in the table configuration
pub fn with_configuration_property(
mut self,
key: DeltaConfigKey,
key: TableProperty,
value: Option<impl Into<String>>,
) -> Self {
self.configuration
Expand All @@ -213,7 +213,7 @@ impl CreateBuilder {
self
}

/// Specify whether to raise an error if the table properties in the configuration are not DeltaConfigKeys
/// Specify whether to raise an error if the table properties in the configuration are not TablePropertys
pub fn with_raise_if_key_not_exists(mut self, raise_if_key_not_exists: bool) -> Self {
self.raise_if_key_not_exists = raise_if_key_not_exists;
self
Expand Down Expand Up @@ -393,7 +393,7 @@ impl std::future::IntoFuture for CreateBuilder {
mod tests {
use super::*;
use crate::operations::DeltaOps;
use crate::table::config::DeltaConfigKey;
use crate::table::config::TableProperty;
use crate::writer::test_utils::{get_delta_schema, get_record_batch};
use tempfile::TempDir;

Expand Down Expand Up @@ -485,14 +485,14 @@ mod tests {
let table = CreateBuilder::new()
.with_location("memory://")
.with_columns(schema.fields().cloned())
.with_configuration_property(DeltaConfigKey::AppendOnly, Some("true"))
.with_configuration_property(TableProperty::AppendOnly, Some("true"))
.await
.unwrap();
let append = table
.metadata()
.unwrap()
.configuration
.get(DeltaConfigKey::AppendOnly.as_ref())
.get(TableProperty::AppendOnly.as_ref())
.unwrap()
.as_ref()
.unwrap()
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/operations/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ mod tests {
use crate::writer::test_utils::{
get_arrow_schema, get_delta_schema, get_record_batch, setup_table_with_configuration,
};
use crate::DeltaConfigKey;
use crate::DeltaTable;
use crate::TableProperty;
use arrow::array::Int32Array;
use arrow::datatypes::{Field, Schema};
use arrow::record_batch::RecordBatch;
Expand Down Expand Up @@ -465,7 +465,7 @@ mod tests {

#[tokio::test]
async fn test_delete_when_delta_table_is_append_only() {
let table = setup_table_with_configuration(DeltaConfigKey::AppendOnly, Some("true")).await;
let table = setup_table_with_configuration(TableProperty::AppendOnly, Some("true")).await;
let batch = get_record_batch(None, false);
// append some data
let table = write_batch(table, batch).await;
Expand Down Expand Up @@ -909,7 +909,7 @@ mod tests {
true,
None,
)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down Expand Up @@ -987,7 +987,7 @@ mod tests {
None,
)
.with_partition_columns(vec!["year"])
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/operations/load_cdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ pub(crate) mod tests {

use crate::test_utils::TestSchemas;
use crate::writer::test_utils::TestResult;
use crate::{DeltaConfigKey, DeltaOps, DeltaTable};
use crate::{DeltaOps, DeltaTable, TableProperty};

#[tokio::test]
async fn test_load_local() -> TestResult {
Expand Down Expand Up @@ -603,7 +603,7 @@ pub(crate) mod tests {
.create()
.with_columns(delta_schema.fields().cloned())
.with_partition_columns(["id"])
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/operations/merge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,8 @@ mod tests {
use crate::writer::test_utils::get_arrow_schema;
use crate::writer::test_utils::get_delta_schema;
use crate::writer::test_utils::setup_table_with_configuration;
use crate::DeltaConfigKey;
use crate::DeltaTable;
use crate::TableProperty;
use arrow::datatypes::Schema as ArrowSchema;
use arrow::record_batch::RecordBatch;
use arrow_schema::DataType as ArrowDataType;
Expand Down Expand Up @@ -1426,7 +1426,7 @@ mod tests {
#[tokio::test]
async fn test_merge_when_delta_table_is_append_only() {
let schema = get_arrow_schema(&None);
let table = setup_table_with_configuration(DeltaConfigKey::AppendOnly, Some("true")).await;
let table = setup_table_with_configuration(TableProperty::AppendOnly, Some("true")).await;
// append some data
let table = write_data(table, &schema).await;
// merge
Expand Down Expand Up @@ -3107,7 +3107,7 @@ mod tests {
.create()
.with_columns(schema.fields().cloned())
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down Expand Up @@ -3202,7 +3202,7 @@ mod tests {
.create()
.with_columns(schema.fields().cloned())
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/operations/transaction/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ mod tests {
use crate::protocol::SaveMode;
use crate::table::state::DeltaTableState;
use crate::test_utils::{ActionFactory, TestSchemas};
use crate::DeltaConfigKey;
use crate::TableProperty;

fn metadata_action(configuration: Option<HashMap<String, Option<String>>>) -> Metadata {
ActionFactory::metadata(TestSchemas::simple(), None::<Vec<&str>>, configuration)
Expand Down Expand Up @@ -328,7 +328,7 @@ mod tests {
..Default::default()
}),
metadata_action(Some(HashMap::from([(
DeltaConfigKey::AppendOnly.as_ref().to_string(),
TableProperty::AppendOnly.as_ref().to_string(),
Some(append.to_string()),
)])))
.into(),
Expand Down Expand Up @@ -630,7 +630,7 @@ mod tests {
)])),
)
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.expect("failed to make a version 4 table with EnableChangeDataFeed");
let eager_5 = table
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/operations/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ mod tests {
use crate::writer::test_utils::{
get_arrow_schema, get_delta_schema, get_record_batch, setup_table_with_configuration,
};
use crate::{DeltaConfigKey, DeltaTable};
use crate::{DeltaTable, TableProperty};
use arrow::array::{Int32Array, StringArray};
use arrow::datatypes::Schema as ArrowSchema;
use arrow::datatypes::{Field, Schema};
Expand Down Expand Up @@ -549,7 +549,7 @@ mod tests {

#[tokio::test]
async fn test_update_when_delta_table_is_append_only() {
let table = setup_table_with_configuration(DeltaConfigKey::AppendOnly, Some("true")).await;
let table = setup_table_with_configuration(TableProperty::AppendOnly, Some("true")).await;
let batch = get_record_batch(None, false);
// Append
let table = write_batch(table, batch).await;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ mod tests {
None,
)
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down Expand Up @@ -1147,7 +1147,7 @@ mod tests {
)
.with_partition_columns(vec!["year"])
.with_actions(actions)
.with_configuration_property(DeltaConfigKey::EnableChangeDataFeed, Some("true"))
.with_configuration_property(TableProperty::EnableChangeDataFeed, Some("true"))
.await
.unwrap();
assert_eq!(table.version(), 0);
Expand Down
Loading

0 comments on commit e5fd2bc

Please sign in to comment.