Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored and XiangpengHao committed Jul 10, 2024
1 parent b418f7a commit 3294c47
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 34 deletions.
8 changes: 2 additions & 6 deletions arrow-array/src/array/fixed_size_list_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions arrow-json/src/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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![
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions arrow-json/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions arrow/tests/array_equal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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()
Expand All @@ -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())
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/arrow/arrow_writer/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions parquet/src/arrow/arrow_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down

0 comments on commit 3294c47

Please sign in to comment.