Skip to content

Commit

Permalink
Preserve existing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneykinney committed May 26, 2023
1 parent 47c4ab9 commit e0d8fc1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pretrain_data/mixer/src/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,14 @@ impl Shard {
}

if !attrs.is_empty() {
mutable_data["attributes"] = Value::Object(attrs);
// Add to existing attributes if they exist, otherwise create them.
if let Value::Object(ref mut existing_attrs) = mutable_data["attributes"] {
for (k, v) in attrs.iter() {
existing_attrs.insert(k.clone(), v.clone());
}
} else {
mutable_data["attributes"] = Value::Object(attrs);
}
}

let mut should_write = true;
Expand Down

0 comments on commit e0d8fc1

Please sign in to comment.