Skip to content

Commit

Permalink
Deprecate combine_option_bitmap (#4005)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold authored Apr 3, 2023
1 parent 533e983 commit 877a3a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
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

0 comments on commit 877a3a0

Please sign in to comment.