Skip to content

Commit

Permalink
Merge pull request #14 from synnada-ai/record-batch-flags
Browse files Browse the repository at this point in the history
Move Nullability Converter Into Schema Utils
  • Loading branch information
berkaysynnada authored Nov 27, 2024
2 parents 5823472 + 97347c0 commit 0754d75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
15 changes: 0 additions & 15 deletions arrow-array/src/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,21 +656,6 @@ impl RecordBatch {
.sum()
}

/// THIS METHOD IS ARAS ONLY
///
/// Converts the fields of the batch to nullable.
pub fn make_fields_nullable(&mut self) {
let fields = self
.schema()
.fields()
.iter()
.map(|field| field.as_ref().clone().with_nullable(true)).collect::<Vec<_>>();
self.schema = Arc::new(Schema::new_with_metadata(
fields,
self.schema().metadata().clone(),
));
}

/// THIS METHOD IS ARAS ONLY
///
/// Gets the metadata_flags of RecordBatch
Expand Down
11 changes: 11 additions & 0 deletions arrow-schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,17 @@ impl Schema {
pub fn remove(&mut self, index: usize) -> FieldRef {
self.fields.remove(index)
}

/// THIS METHOD IS ARAS ONLY
///
/// Converts the fields of the batch to nullable.
pub fn make_fields_nullable(&mut self) {
let fields = self
.fields
.iter()
.map(|field| field.as_ref().clone().with_nullable(true));
self.fields = Fields::from_iter(fields);
}
}

impl fmt::Display for Schema {
Expand Down

0 comments on commit 0754d75

Please sign in to comment.