Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Optimized binaryArray. (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Nov 12, 2021
1 parent 3caa204 commit edf5cbc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/array/binary/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@ impl<O: Offset> MutableBinaryArray<O> {
}

fn init_validity(&mut self) {
self.validity = Some(MutableBitmap::from_trusted_len_iter(
std::iter::repeat(true)
.take(self.len() - 1)
.chain(std::iter::once(false)),
))
let mut validity = MutableBitmap::with_capacity(self.offsets.capacity());
validity.extend_constant(self.len(), true);
validity.set(self.len() - 1, false);
self.validity = Some(validity)
}

/// Converts itself into an [`Array`].
Expand Down

0 comments on commit edf5cbc

Please sign in to comment.