Skip to content

Commit

Permalink
fix unused app_metadata in create operation
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Dec 27, 2023
1 parent 5717c02 commit e4cc1b3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions crates/deltalake-core/src/operations/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::sync::Arc;

use futures::future::BoxFuture;
use serde_json::{Map, Value};
use serde_json::Value;

use super::transaction::{commit, PROTOCOL};
use crate::errors::{DeltaResult, DeltaTableError};
Expand Down Expand Up @@ -56,7 +56,7 @@ pub struct CreateBuilder {
actions: Vec<Action>,
log_store: Option<LogStoreRef>,
configuration: HashMap<String, Option<String>>,
metadata: Option<Map<String, Value>>,
metadata: Option<HashMap<String, Value>>,
}

impl Default for CreateBuilder {
Expand Down Expand Up @@ -181,8 +181,11 @@ impl CreateBuilder {
///
/// This might include provenance information such as an id of the
/// user that made the commit or the program that created it.
pub fn with_metadata(mut self, metadata: Map<String, Value>) -> Self {
self.metadata = Some(metadata);
pub fn with_metadata(
mut self,
metadata: impl IntoIterator<Item = (String, serde_json::Value)>,
) -> Self {
self.metadata = Some(HashMap::from_iter(metadata));
self
}

Expand Down Expand Up @@ -286,6 +289,7 @@ impl std::future::IntoFuture for CreateBuilder {
let this = self;
Box::pin(async move {
let mode = this.mode.clone();
let app_metadata = this.metadata.clone();
let (mut table, actions, operation) = this.into_table_and_actions()?;
let log_store = table.log_store();
let table_state = if log_store.is_delta_table_location().await? {
Expand All @@ -310,7 +314,7 @@ impl std::future::IntoFuture for CreateBuilder {
&actions,
operation,
table_state,
None,
app_metadata,
)
.await?;
table.load_version(version).await?;
Expand Down

0 comments on commit e4cc1b3

Please sign in to comment.