Skip to content

Commit

Permalink
Rename list contains kernels to in_list (apache#4289) (apache#4342)
Browse files Browse the repository at this point in the history
* Rename list contains kernels to in_list (apache#4289)

* Fix other clippy lints
  • Loading branch information
tustvold authored Jun 2, 2023
1 parent a121e09 commit 7952595
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
12 changes: 6 additions & 6 deletions arrow-ord/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ where
}

/// Checks if a [`GenericListArray`] contains a value in the [`PrimitiveArray`]
pub fn contains<T, OffsetSize>(
pub fn in_list<T, OffsetSize>(
left: &PrimitiveArray<T>,
right: &GenericListArray<OffsetSize>,
) -> Result<BooleanArray, ArrowError>
Expand Down Expand Up @@ -2742,7 +2742,7 @@ where
}

/// Checks if a [`GenericListArray`] contains a value in the [`GenericStringArray`]
pub fn contains_utf8<OffsetSize>(
pub fn in_list_utf8<OffsetSize>(
left: &GenericStringArray<OffsetSize>,
right: &ListArray,
) -> Result<BooleanArray, ArrowError>
Expand Down Expand Up @@ -3425,7 +3425,7 @@ mod tests {
let list_array = LargeListArray::from(list_data);

let nulls = Int32Array::from(vec![None, None, None, None]);
let nulls_result = contains(&nulls, &list_array).unwrap();
let nulls_result = in_list(&nulls, &list_array).unwrap();
assert_eq!(
nulls_result
.as_any()
Expand All @@ -3435,7 +3435,7 @@ mod tests {
);

let values = Int32Array::from(vec![Some(0), Some(0), Some(0), Some(0)]);
let values_result = contains(&values, &list_array).unwrap();
let values_result = in_list(&values, &list_array).unwrap();
assert_eq!(
values_result
.as_any()
Expand Down Expand Up @@ -3695,7 +3695,7 @@ mod tests {

let v: Vec<Option<&str>> = vec![None, None, None, None];
let nulls = StringArray::from(v);
let nulls_result = contains_utf8(&nulls, &list_array).unwrap();
let nulls_result = in_list_utf8(&nulls, &list_array).unwrap();
assert_eq!(
nulls_result
.as_any()
Expand All @@ -3710,7 +3710,7 @@ mod tests {
Some("Lorem"),
Some("Lorem"),
]);
let values_result = contains_utf8(&values, &list_array).unwrap();
let values_result = in_list_utf8(&values, &list_array).unwrap();
assert_eq!(
values_result
.as_any()
Expand Down
3 changes: 1 addition & 2 deletions arrow/examples/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
// specific language governing permissions and limitations
// under the License.

///! Many builders are available to easily create different types of arrow arrays
extern crate arrow;
//! Many builders are available to easily create different types of arrow arrays
use std::sync::Arc;

Expand Down
5 changes: 3 additions & 2 deletions arrow/examples/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
// specific language governing permissions and limitations
// under the License.

///! `FromIterator` API is implemented for different array types to easily create them
/// from values.
//! `FromIterator` API is implemented for different array types to easily create them
//! from values.
use arrow::array::Array;
use arrow_array::types::Int32Type;
use arrow_array::{Float32Array, Int32Array, Int8Array, ListArray};
Expand Down
2 changes: 1 addition & 1 deletion arrow/examples/dynamic_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

///! This example demonstrates dealing with mixed types dynamically at runtime
//! This example demonstrates dealing with mixed types dynamically at runtime
use std::sync::Arc;

extern crate arrow;
Expand Down
3 changes: 1 addition & 2 deletions arrow/examples/tensor_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
// specific language governing permissions and limitations
// under the License.

///! Tensor builder example
extern crate arrow;
//! Tensor builder example
use arrow::array::*; //{Int32BufferBuilder, Float32BufferBuilder};
use arrow::buffer::Buffer;
Expand Down
3 changes: 1 addition & 2 deletions arrow/tests/array_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,7 @@ fn test_try_new_sliced_struct() {

let struct_array = builder.finish();
let struct_array_slice = struct_array.slice(1, 3);
let cloned = struct_array_slice.clone();
assert_eq!(&struct_array_slice, &cloned);
assert_eq!(struct_array_slice, struct_array_slice);
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions parquet/src/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ macro_rules! gen_as_bytes {
unsafe {
std::slice::from_raw_parts(
self_.as_ptr() as *const u8,
std::mem::size_of::<$source_ty>() * self_.len(),
std::mem::size_of_val(self_),
)
}
}
Expand All @@ -493,7 +493,7 @@ macro_rules! gen_as_bytes {
unsafe fn slice_as_bytes_mut(self_: &mut [Self]) -> &mut [u8] {
std::slice::from_raw_parts_mut(
self_.as_mut_ptr() as *mut u8,
std::mem::size_of::<$source_ty>() * self_.len(),
std::mem::size_of_val(self_),
)
}
}
Expand Down Expand Up @@ -735,7 +735,7 @@ pub(crate) mod private {
let raw = unsafe {
std::slice::from_raw_parts(
values.as_ptr() as *const u8,
std::mem::size_of::<$ty>() * values.len(),
std::mem::size_of_val(values),
)
};
writer.write_all(raw)?;
Expand Down

0 comments on commit 7952595

Please sign in to comment.