You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/06/02 10:06:06 UTC
[arrow-rs] branch master updated: Rename list contains kernels to in_list (#4289) (#4342)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 795259502 Rename list contains kernels to in_list (#4289) (#4342)
795259502 is described below
commit 795259502d8d19f1e929d8ebf1b2819b6ab145c4
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Fri Jun 2 11:05:59 2023 +0100
Rename list contains kernels to in_list (#4289) (#4342)
* Rename list contains kernels to in_list (#4289)
* Fix other clippy lints
---
arrow-ord/src/comparison.rs | 12 ++++++------
arrow/examples/builders.rs | 3 +--
arrow/examples/collect.rs | 5 +++--
arrow/examples/dynamic_types.rs | 2 +-
arrow/examples/tensor_builder.rs | 3 +--
arrow/tests/array_validation.rs | 3 +--
parquet/src/data_type.rs | 6 +++---
7 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/arrow-ord/src/comparison.rs b/arrow-ord/src/comparison.rs
index c771182f7..b9274f0ea 100644
--- a/arrow-ord/src/comparison.rs
+++ b/arrow-ord/src/comparison.rs
@@ -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>
@@ -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>
@@ -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()
@@ -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()
@@ -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()
@@ -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()
diff --git a/arrow/examples/builders.rs b/arrow/examples/builders.rs
index a6d8c563b..250f5c39a 100644
--- a/arrow/examples/builders.rs
+++ b/arrow/examples/builders.rs
@@ -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;
diff --git a/arrow/examples/collect.rs b/arrow/examples/collect.rs
index 5581186db..ced4640d6 100644
--- a/arrow/examples/collect.rs
+++ b/arrow/examples/collect.rs
@@ -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};
diff --git a/arrow/examples/dynamic_types.rs b/arrow/examples/dynamic_types.rs
index 5470131d6..8ec473c76 100644
--- a/arrow/examples/dynamic_types.rs
+++ b/arrow/examples/dynamic_types.rs
@@ -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;
diff --git a/arrow/examples/tensor_builder.rs b/arrow/examples/tensor_builder.rs
index ca31679e2..90ad1b486 100644
--- a/arrow/examples/tensor_builder.rs
+++ b/arrow/examples/tensor_builder.rs
@@ -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;
diff --git a/arrow/tests/array_validation.rs b/arrow/tests/array_validation.rs
index 67960ada6..0d3652a04 100644
--- a/arrow/tests/array_validation.rs
+++ b/arrow/tests/array_validation.rs
@@ -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]
diff --git a/parquet/src/data_type.rs b/parquet/src/data_type.rs
index 2e7f73bf0..67d0bad98 100644
--- a/parquet/src/data_type.rs
+++ b/parquet/src/data_type.rs
@@ -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_),
)
}
}
@@ -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_),
)
}
}
@@ -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)?;