diff --git a/arrow-array/src/array/fixed_size_list_array.rs b/arrow-array/src/array/fixed_size_list_array.rs index 53c9d8970ca2..0d57d9a690aa 100644 --- a/arrow-array/src/array/fixed_size_list_array.rs +++ b/arrow-array/src/array/fixed_size_list_array.rs @@ -462,7 +462,7 @@ impl<'a> ArrayAccessor for &'a FixedSizeListArray { #[cfg(test)] mod tests { - use arrow_buffer::{bit_util, BooleanBuffer, Buffer, ToByteSlice}; + use arrow_buffer::{bit_util, BooleanBuffer, Buffer}; use arrow_schema::Field; use crate::cast::AsArray; @@ -674,11 +674,7 @@ mod tests { assert_eq!(err.to_string(), "Invalid argument error: Found unmasked nulls for non-nullable FixedSizeListArray field \"item\""); // Valid as nulls in child masked by parent - let nulls = NullBuffer::new(BooleanBuffer::new( - Buffer::from(vec![0b0000101].to_byte_slice()), - 0, - 3, - )); + let nulls = NullBuffer::new(BooleanBuffer::new(Buffer::from([0b0000101]), 0, 3)); FixedSizeListArray::new(field, 2, values.clone(), Some(nulls)); let field = Arc::new(Field::new("item", DataType::Int64, true)); diff --git a/arrow-json/src/reader/mod.rs b/arrow-json/src/reader/mod.rs index d22ff8981e3e..97d9c8962618 100644 --- a/arrow-json/src/reader/mod.rs +++ b/arrow-json/src/reader/mod.rs @@ -715,7 +715,7 @@ mod tests { use arrow_array::cast::AsArray; use arrow_array::{Array, BooleanArray, Float64Array, ListArray, StringArray}; - use arrow_buffer::{ArrowNativeType, Buffer, ToByteSlice}; + use arrow_buffer::{ArrowNativeType, Buffer}; use arrow_cast::display::{ArrayFormatter, FormatOptions}; use arrow_data::ArrayDataBuilder; use arrow_schema::Field; @@ -1850,7 +1850,7 @@ mod tests { let c = ArrayDataBuilder::new(c_field.data_type().clone()) .len(7) .add_child_data(d.to_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00111011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00111011]))) .build() .unwrap(); let b = BooleanArray::from(vec![ @@ -1866,14 +1866,14 @@ mod tests { .len(7) .add_child_data(b.to_data()) .add_child_data(c.clone()) - .null_bit_buffer(Some(Buffer::from(vec![0b00111111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00111111]))) .build() .unwrap(); let a_list = ArrayDataBuilder::new(a_field.data_type().clone()) .len(6) .add_buffer(Buffer::from_slice_ref([0i32, 2, 3, 6, 6, 6, 7])) .add_child_data(a) - .null_bit_buffer(Some(Buffer::from(vec![0b00110111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00110111]))) .build() .unwrap(); let expected = make_array(a_list); diff --git a/arrow-json/src/writer.rs b/arrow-json/src/writer.rs index 42ea86f1e2eb..86d2e88d99f0 100644 --- a/arrow-json/src/writer.rs +++ b/arrow-json/src/writer.rs @@ -932,7 +932,7 @@ mod tests { .len(5) .add_buffer(a_value_offsets) .add_child_data(a_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00011111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011111]))) .build() .unwrap(); let a = ListArray::from(a_list_data); @@ -981,7 +981,7 @@ mod tests { let a_list_data = ArrayData::builder(list_inner_type.data_type().clone()) .len(3) .add_buffer(a_value_offsets) - .null_bit_buffer(Some(Buffer::from(vec![0b00000111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00000111]))) .add_child_data(a_values.into_data()) .build() .unwrap(); @@ -1063,7 +1063,7 @@ mod tests { .len(3) .add_buffer(c1_value_offsets) .add_child_data(struct_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00000101].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00000101]))) .build() .unwrap(); let c1 = ListArray::from(c1_list_data); diff --git a/arrow/tests/array_equal.rs b/arrow/tests/array_equal.rs index 56f428b57b95..7ed4dae1ed08 100644 --- a/arrow/tests/array_equal.rs +++ b/arrow/tests/array_equal.rs @@ -445,7 +445,7 @@ fn test_empty_offsets_list_equal() { .len(0) .add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice())) .add_child_data(Int32Array::from(vec![1, 2, -1, -2, 3, 4, -3, -4]).into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00001001].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001001]))) .build() .unwrap() .into(); @@ -483,7 +483,7 @@ fn test_list_null() { .len(6) .add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice())) .add_child_data(c_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00001001].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001001]))) .build() .unwrap() .into(); @@ -506,7 +506,7 @@ fn test_list_null() { .len(6) .add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice())) .add_child_data(d_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00001001].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001001]))) .build() .unwrap() .into(); @@ -807,7 +807,7 @@ fn test_struct_equal_null() { Field::new("f1", DataType::Utf8, true), Field::new("f2", DataType::Int32, true), ]))) - .null_bit_buffer(Some(Buffer::from(vec![0b00001011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001011]))) .len(5) .add_child_data(strings.to_data()) .add_child_data(ints.to_data()) @@ -819,7 +819,7 @@ fn test_struct_equal_null() { Field::new("f1", DataType::Utf8, true), Field::new("f2", DataType::Int32, true), ]))) - .null_bit_buffer(Some(Buffer::from(vec![0b00001011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001011]))) .len(5) .add_child_data(strings.to_data()) .add_child_data(ints_non_null.to_data()) @@ -835,7 +835,7 @@ fn test_struct_equal_null() { Field::new("f1", DataType::Utf8, true), Field::new("f2", DataType::Int32, true), ]))) - .null_bit_buffer(Some(Buffer::from(vec![0b00001011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001011]))) .len(5) .add_child_data(strings.to_data()) .add_child_data(c_ints_non_null.to_data()) @@ -849,7 +849,7 @@ fn test_struct_equal_null() { let a = ArrayData::builder(DataType::Struct( vec![Field::new("f3", a.data_type().clone(), true)].into(), )) - .null_bit_buffer(Some(Buffer::from(vec![0b00011110].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011110]))) .len(5) .add_child_data(a.to_data()) .build() @@ -868,7 +868,7 @@ fn test_struct_equal_null() { Field::new("f1", DataType::Utf8, true), Field::new("f2", DataType::Int32, true), ]))) - .null_bit_buffer(Some(Buffer::from(vec![0b00001011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001011]))) .len(5) .add_child_data(strings.to_data()) .add_child_data(ints_non_null.to_data()) @@ -878,7 +878,7 @@ fn test_struct_equal_null() { let b = ArrayData::builder(DataType::Struct( vec![Field::new("f3", b.data_type().clone(), true)].into(), )) - .null_bit_buffer(Some(Buffer::from(vec![0b00011110].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011110]))) .len(5) .add_child_data(b) .build() @@ -909,7 +909,7 @@ fn test_struct_equal_null_variable_size() { let a = ArrayData::builder(DataType::Struct( vec![Field::new("f1", DataType::Utf8, true)].into(), )) - .null_bit_buffer(Some(Buffer::from(vec![0b00001010].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001010]))) .len(5) .add_child_data(strings1.to_data()) .build() @@ -919,7 +919,7 @@ fn test_struct_equal_null_variable_size() { let b = ArrayData::builder(DataType::Struct( vec![Field::new("f1", DataType::Utf8, true)].into(), )) - .null_bit_buffer(Some(Buffer::from(vec![0b00001010].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001010]))) .len(5) .add_child_data(strings2.to_data()) .build() @@ -939,7 +939,7 @@ fn test_struct_equal_null_variable_size() { let c = ArrayData::builder(DataType::Struct( vec![Field::new("f1", DataType::Utf8, true)].into(), )) - .null_bit_buffer(Some(Buffer::from(vec![0b00001011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00001011]))) .len(5) .add_child_data(strings3.to_data()) .build() diff --git a/parquet/src/arrow/arrow_writer/levels.rs b/parquet/src/arrow/arrow_writer/levels.rs index b28ac434e31b..3e828bbddd17 100644 --- a/parquet/src/arrow/arrow_writer/levels.rs +++ b/parquet/src/arrow/arrow_writer/levels.rs @@ -1050,7 +1050,7 @@ mod tests { let a_list_data = ArrayData::builder(a_list_type.clone()) .len(5) .add_buffer(a_value_offsets) - .null_bit_buffer(Some(Buffer::from(vec![0b00011011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011011]))) .add_child_data(a_values.to_data()) .build() .unwrap(); diff --git a/parquet/src/arrow/arrow_writer/mod.rs b/parquet/src/arrow/arrow_writer/mod.rs index 7b444bb9aa82..cf46f3b64a57 100644 --- a/parquet/src/arrow/arrow_writer/mod.rs +++ b/parquet/src/arrow/arrow_writer/mod.rs @@ -1217,7 +1217,7 @@ mod tests { .len(5) .add_buffer(a_value_offsets) .add_child_data(a_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00011011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011011]))) .build() .unwrap(); let a = ListArray::from(a_list_data); @@ -1420,7 +1420,7 @@ mod tests { .len(5) .add_buffer(g_value_offsets) .add_child_data(g_value.to_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00011011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011011]))) .build() .unwrap(); let h = ListArray::from(h_list_data); @@ -1525,14 +1525,14 @@ mod tests { let c = Int32Array::from(vec![Some(1), None, Some(3), None, None, Some(6)]); let b_data = ArrayDataBuilder::new(field_b.data_type().clone()) .len(6) - .null_bit_buffer(Some(Buffer::from(vec![0b00100111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00100111]))) .add_child_data(c.into_data()) .build() .unwrap(); let b = StructArray::from(b_data); let a_data = ArrayDataBuilder::new(field_a.data_type().clone()) .len(6) - .null_bit_buffer(Some(Buffer::from(vec![0b00101111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00101111]))) .add_child_data(b.into_data()) .build() .unwrap(); @@ -1595,7 +1595,7 @@ mod tests { let c = Int32Array::from(vec![1, 2, 3, 4, 5, 6]); let b_data = ArrayDataBuilder::new(type_b) .len(6) - .null_bit_buffer(Some(Buffer::from(vec![0b00100111].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00100111]))) .add_child_data(c.into_data()) .build() .unwrap(); @@ -2288,7 +2288,7 @@ mod tests { )))) .len(3) .add_buffer(a_value_offsets) - .null_bit_buffer(Some(Buffer::from(vec![0b00000101].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00000101]))) .add_child_data(a_values.into_data()) .build() .unwrap(); @@ -2318,7 +2318,7 @@ mod tests { )))) .len(5) .add_buffer(a_value_offsets) - .null_bit_buffer(Some(Buffer::from(vec![0b00011011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011011]))) .add_child_data(a_values.into_data()) .build() .unwrap(); @@ -2343,7 +2343,7 @@ mod tests { .len(5) .add_buffer(a_value_offsets) .add_child_data(a_values.into_data()) - .null_bit_buffer(Some(Buffer::from(vec![0b00011011].to_byte_slice()))) + .null_bit_buffer(Some(Buffer::from([0b00011011]))) .build() .unwrap();