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

Deprecate combine_option_bitmap #4005

Merged
merged 1 commit into from
Apr 3, 2023
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
3 changes: 3 additions & 0 deletions arrow-data/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub fn set_bits(
/// Combines the null bitmaps of multiple arrays using a bitwise `and` operation.
///
/// This function is useful when implementing operations on higher level arrays.
#[deprecated(note = "Use NullBuffer::union")]
pub fn combine_option_bitmap(
arrays: &[&ArrayData],
len_in_bits: usize,
Expand Down Expand Up @@ -247,6 +248,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_combine_option_bitmap() {
let none_bitmap = make_data_with_null_bit_buffer(8, 0, None);
let some_bitmap =
Expand Down Expand Up @@ -298,6 +300,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn test_combine_option_bitmap_with_offsets() {
let none_bitmap = make_data_with_null_bit_buffer(8, 0, None);
let bitmap0 =
Expand Down
14 changes: 4 additions & 10 deletions arrow-string/src/concat_elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use arrow_array::builder::BufferBuilder;
use arrow_array::types::ByteArrayType;
use arrow_array::*;
use arrow_buffer::{ArrowNativeType, NullBuffer};
use arrow_data::bit_mask::combine_option_bitmap;
use arrow_data::ArrayDataBuilder;
use arrow_schema::{ArrowError, DataType};

Expand Down Expand Up @@ -125,14 +124,9 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
)));
}

let output_bitmap = combine_option_bitmap(
arrays
.iter()
.map(|a| a.data())
.collect::<Vec<_>>()
.as_slice(),
size,
);
let nulls = arrays
.iter()
.fold(None, |acc, a| NullBuffer::union(acc.as_ref(), a.nulls()));

let data_values = arrays
.iter()
Expand Down Expand Up @@ -170,7 +164,7 @@ pub fn concat_elements_utf8_many<Offset: OffsetSizeTrait>(
.len(size)
.add_buffer(output_offsets.finish())
.add_buffer(output_values.finish())
.null_bit_buffer(output_bitmap);
.nulls(nulls);

// SAFETY - offsets valid by construction
Ok(unsafe { builder.build_unchecked() }.into())
Expand Down