From c7e19a05cfc6e0f2014c2c75af9467e2bea746ad Mon Sep 17 00:00:00 2001 From: berkaysynnada Date: Wed, 27 Nov 2024 13:33:51 +0300 Subject: [PATCH] Update record_batch.rs Update record_batch.rs --- arrow-array/src/record_batch.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arrow-array/src/record_batch.rs b/arrow-array/src/record_batch.rs index 24806ea61195..217cd5c21849 100644 --- a/arrow-array/src/record_batch.rs +++ b/arrow-array/src/record_batch.rs @@ -656,6 +656,21 @@ 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::>(); + self.schema = Arc::new(Schema::new_with_metadata( + fields, + self.schema().metadata().clone(), + )); + } + /// THIS METHOD IS ARAS ONLY /// /// Gets the metadata_flags of RecordBatch