Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Jan 30, 2024
1 parent 3d57025 commit 1540a04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
5 changes: 1 addition & 4 deletions crates/deltalake-core/src/operations/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ impl std::future::IntoFuture for ConstraintBuilder {
expr: expr_str.clone(),
};

let app_metadata = match this.app_metadata {
Some(metadata) => metadata,
None => HashMap::default(),
};
let app_metadata = this.app_metadata.unwrap_or_default();

let commit_info = CommitInfo {
timestamp: Some(Utc::now().timestamp_millis()),
Expand Down
22 changes: 8 additions & 14 deletions crates/deltalake-core/src/operations/drop_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,16 @@ impl std::future::IntoFuture for DropConstraintBuilder {
.configuration
.remove(format!("delta.constraints.{}", name).as_str());

let mut contains_constraints: bool = false;
for key in metadata.configuration.keys() {
if key.starts_with("delta.constraints") {
contains_constraints = true;
break;
} else {
continue;
}
}
let contains_constraints = metadata
.configuration
.keys()
.any(|k| k.starts_with("delta.constraints"));

let operational_parameters = HashMap::from_iter([("name".to_string(), json!(&name))]);

let operations = DeltaOperation::DropConstraint { name: name.clone() };

let app_metadata = match this.app_metadata {
Some(metadata) => metadata,
None => HashMap::default(),
};
let app_metadata = this.app_metadata.unwrap_or_default();

let commit_info = CommitInfo {
timestamp: Some(Utc::now().timestamp_millis()),
Expand Down Expand Up @@ -146,7 +138,9 @@ impl std::future::IntoFuture for DropConstraintBuilder {

let mut actions = vec![Action::CommitInfo(commit_info), Action::Metadata(metadata)];

protocol.map(|protocol| actions.push(Action::Protocol(protocol)));
if let Some(protocol) = protocol {
actions.push(Action::Protocol(protocol))
};

let version = commit(
this.log_store.as_ref(),
Expand Down

0 comments on commit 1540a04

Please sign in to comment.