Skip to content

Commit

Permalink
follow reviews
Browse files Browse the repository at this point in the history
Signed-off-by: fan <[email protected]>
  • Loading branch information
fansehep committed Oct 25, 2023
1 parent 468adb3 commit a176b41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arrow-schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ impl SchemaBuilder {
self.fields.remove(idx)
}

/// Change the FieldRef as index `idx`
/// Get mut FieldRef as index `idx`
/// if index out of bounds, will panic
pub fn change_field(&mut self, idx: usize, field: impl Into<FieldRef>) {
self.fields[idx] = field.into()
pub fn field_mut(&mut self, idx: usize) -> &mut FieldRef {
&mut self.fields[idx]
}

/// Reverse the fileds
Expand Down Expand Up @@ -854,7 +854,7 @@ mod tests {
let mut builder = SchemaBuilder::new();
builder.push(Field::new("a", DataType::Int32, false));
builder.push(Field::new("b", DataType::Utf8, false));
builder.change_field(1, Field::new("c", DataType::Int32, false));
*builder.field_mut(1) = Arc::new(Field::new("c", DataType::Int32, false));
assert_eq!(
builder.fields,
vec![
Expand Down

0 comments on commit a176b41

Please sign in to comment.