Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement logical_null_count for more array types #6704

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions arrow-array/src/array/byte_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ impl<T: ByteArrayType> Array for GenericByteArray<T> {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut sum = self.value_offsets.inner().inner().capacity();
sum += self.value_data.capacity();
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/byte_view_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ impl<T: ByteViewType + ?Sized> Array for GenericByteViewArray<T> {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut sum = self.buffers.iter().map(|b| b.capacity()).sum::<usize>();
sum += self.views.inner().capacity();
Expand Down
4 changes: 4 additions & 0 deletions arrow-array/src/array/dictionary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ impl<K: ArrowDictionaryKeyType, V: Sync> Array for TypedDictionaryArray<'_, K, V
self.dictionary.logical_nulls()
}

fn logical_null_count(&self) -> usize {
self.dictionary.logical_null_count()
}

fn is_nullable(&self) -> bool {
self.dictionary.is_nullable()
}
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/fixed_size_binary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ impl Array for FixedSizeBinaryArray {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut sum = self.value_data.capacity();
if let Some(n) = &self.nulls {
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/fixed_size_list_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ impl Array for FixedSizeListArray {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut size = self.values.get_buffer_memory_size();
if let Some(n) = self.nulls.as_ref() {
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/list_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ impl<OffsetSize: OffsetSizeTrait> Array for GenericListArray<OffsetSize> {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut size = self.values.get_buffer_memory_size();
size += self.value_offsets.inner().inner().capacity();
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/list_view_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ impl<OffsetSize: OffsetSizeTrait> Array for GenericListViewArray<OffsetSize> {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut size = self.values.get_buffer_memory_size();
size += self.value_offsets.inner().capacity();
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/map_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ impl Array for MapArray {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut size = self.entries.get_buffer_memory_size();
size += self.value_offsets.inner().inner().capacity();
Expand Down
4 changes: 4 additions & 0 deletions arrow-array/src/array/run_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,10 @@ impl<R: RunEndIndexType, V: Sync> Array for TypedRunArray<'_, R, V> {
self.run_array.logical_nulls()
}

fn logical_null_count(&self) -> usize {
self.run_array.logical_null_count()
}

fn is_nullable(&self) -> bool {
self.run_array.is_nullable()
}
Expand Down
5 changes: 5 additions & 0 deletions arrow-array/src/array/struct_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ impl Array for StructArray {
self.nulls.as_ref()
}

fn logical_null_count(&self) -> usize {
// More efficient that the default implementation
self.null_count()
}

fn get_buffer_memory_size(&self) -> usize {
let mut size = self.fields.iter().map(|a| a.get_buffer_memory_size()).sum();
if let Some(n) = self.nulls.as_ref() {
Expand Down
Loading