You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/07/28 12:38:29 UTC
[arrow-rs] branch active_release updated: resolve unnecessary
borrow clippy lints (#613) (#622)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch active_release
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/active_release by this push:
new ffe436a resolve unnecessary borrow clippy lints (#613) (#622)
ffe436a is described below
commit ffe436a21b4c9deda2e019b4214f938c6384fcdb
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Jul 28 08:38:20 2021 -0400
resolve unnecessary borrow clippy lints (#613) (#622)
Co-authored-by: Jiayu Liu <Ji...@users.noreply.github.com>
---
arrow-flight/src/utils.rs | 4 ++--
arrow/benches/aggregate_kernels.rs | 8 +++----
arrow/benches/arithmetic_kernels.rs | 8 +++----
arrow/benches/array_from_vec.rs | 8 +++----
arrow/benches/boolean_kernels.rs | 8 +++----
arrow/benches/filter_kernels.rs | 2 +-
arrow/benches/take_kernels.rs | 4 ++--
arrow/src/array/array.rs | 4 ++--
arrow/src/array/array_binary.rs | 2 +-
arrow/src/array/array_boolean.rs | 2 +-
arrow/src/array/array_list.rs | 2 +-
arrow/src/array/array_primitive.rs | 2 +-
arrow/src/array/array_string.rs | 2 +-
arrow/src/array/equal_json.rs | 28 +++++++++++------------
arrow/src/array/ord.rs | 4 ++--
arrow/src/buffer/immutable.rs | 4 ++--
arrow/src/buffer/mod.rs | 6 ++---
arrow/src/buffer/ops.rs | 6 ++---
arrow/src/compute/kernels/aggregate.rs | 4 ++--
arrow/src/compute/kernels/arithmetic.rs | 8 +++----
arrow/src/compute/kernels/boolean.rs | 8 +++----
arrow/src/compute/kernels/cast.rs | 39 ++++++++++++++++-----------------
arrow/src/compute/kernels/filter.rs | 2 +-
arrow/src/compute/kernels/sort.rs | 4 ++--
arrow/src/compute/util.rs | 8 +++----
arrow/src/csv/reader.rs | 10 ++++-----
arrow/src/csv/writer.rs | 2 +-
arrow/src/datatypes/field.rs | 2 +-
arrow/src/ipc/reader.rs | 6 ++---
arrow/src/ipc/writer.rs | 6 ++---
arrow/src/json/writer.rs | 2 +-
arrow/src/tensor.rs | 6 ++---
arrow/src/util/display.rs | 2 +-
arrow/src/util/integration_util.rs | 2 +-
parquet/src/arrow/arrow_array_reader.rs | 8 +++----
parquet/src/arrow/arrow_writer.rs | 30 ++++++++++++-------------
parquet/src/arrow/schema.rs | 2 +-
parquet/src/column/page.rs | 6 ++---
parquet/src/column/writer.rs | 4 ++--
parquet/src/encodings/encoding.rs | 2 +-
parquet/src/file/metadata.rs | 6 ++---
parquet/src/file/serialized_reader.rs | 2 +-
parquet/src/schema/printer.rs | 9 +++-----
parquet/src/schema/types.rs | 4 ++--
44 files changed, 142 insertions(+), 146 deletions(-)
diff --git a/arrow-flight/src/utils.rs b/arrow-flight/src/utils.rs
index 0ebface..9232acc 100644
--- a/arrow-flight/src/utils.rs
+++ b/arrow-flight/src/utils.rs
@@ -36,7 +36,7 @@ pub fn flight_data_from_arrow_batch(
let mut dictionary_tracker = writer::DictionaryTracker::new(false);
let (encoded_dictionaries, encoded_batch) = data_gen
- .encoded_batch(batch, &mut dictionary_tracker, &options)
+ .encoded_batch(batch, &mut dictionary_tracker, options)
.expect("DictionaryTracker configured above to not error on replacement");
let flight_dictionaries = encoded_dictionaries.into_iter().map(Into::into).collect();
@@ -68,7 +68,7 @@ pub fn flight_data_to_arrow_batch(
&data.data_body,
batch,
schema,
- &dictionaries_by_field,
+ dictionaries_by_field,
)
})?
}
diff --git a/arrow/benches/aggregate_kernels.rs b/arrow/benches/aggregate_kernels.rs
index 1724b73..c7b09f7 100644
--- a/arrow/benches/aggregate_kernels.rs
+++ b/arrow/benches/aggregate_kernels.rs
@@ -26,19 +26,19 @@ use arrow::util::bench_util::*;
use arrow::{array::*, datatypes::Float32Type};
fn bench_sum(arr_a: &Float32Array) {
- criterion::black_box(sum(&arr_a).unwrap());
+ criterion::black_box(sum(arr_a).unwrap());
}
fn bench_min(arr_a: &Float32Array) {
- criterion::black_box(min(&arr_a).unwrap());
+ criterion::black_box(min(arr_a).unwrap());
}
fn bench_max(arr_a: &Float32Array) {
- criterion::black_box(max(&arr_a).unwrap());
+ criterion::black_box(max(arr_a).unwrap());
}
fn bench_min_string(arr_a: &StringArray) {
- criterion::black_box(min_string(&arr_a).unwrap());
+ criterion::black_box(min_string(arr_a).unwrap());
}
fn add_benchmark(c: &mut Criterion) {
diff --git a/arrow/benches/arithmetic_kernels.rs b/arrow/benches/arithmetic_kernels.rs
index 721157e..bbe4123 100644
--- a/arrow/benches/arithmetic_kernels.rs
+++ b/arrow/benches/arithmetic_kernels.rs
@@ -44,24 +44,24 @@ fn bench_add(arr_a: &ArrayRef, arr_b: &ArrayRef) {
fn bench_subtract(arr_a: &ArrayRef, arr_b: &ArrayRef) {
let arr_a = arr_a.as_any().downcast_ref::<Float32Array>().unwrap();
let arr_b = arr_b.as_any().downcast_ref::<Float32Array>().unwrap();
- criterion::black_box(subtract(&arr_a, &arr_b).unwrap());
+ criterion::black_box(subtract(arr_a, arr_b).unwrap());
}
fn bench_multiply(arr_a: &ArrayRef, arr_b: &ArrayRef) {
let arr_a = arr_a.as_any().downcast_ref::<Float32Array>().unwrap();
let arr_b = arr_b.as_any().downcast_ref::<Float32Array>().unwrap();
- criterion::black_box(multiply(&arr_a, &arr_b).unwrap());
+ criterion::black_box(multiply(arr_a, arr_b).unwrap());
}
fn bench_divide(arr_a: &ArrayRef, arr_b: &ArrayRef) {
let arr_a = arr_a.as_any().downcast_ref::<Float32Array>().unwrap();
let arr_b = arr_b.as_any().downcast_ref::<Float32Array>().unwrap();
- criterion::black_box(divide(&arr_a, &arr_b).unwrap());
+ criterion::black_box(divide(arr_a, arr_b).unwrap());
}
fn bench_divide_scalar(array: &ArrayRef, divisor: f32) {
let array = array.as_any().downcast_ref::<Float32Array>().unwrap();
- criterion::black_box(divide_scalar(&array, divisor).unwrap());
+ criterion::black_box(divide_scalar(array, divisor).unwrap());
}
fn bench_limit(arr_a: &ArrayRef, max: usize) {
diff --git a/arrow/benches/array_from_vec.rs b/arrow/benches/array_from_vec.rs
index 7740c6b..01ddf35 100644
--- a/arrow/benches/array_from_vec.rs
+++ b/arrow/benches/array_from_vec.rs
@@ -97,22 +97,22 @@ fn criterion_benchmark(c: &mut Criterion) {
let (field1, strings, field2, ints) = struct_array_values(128);
c.bench_function("struct_array_from_vec 128", |b| {
- b.iter(|| struct_array_from_vec(&field1, &strings, &field2, &ints))
+ b.iter(|| struct_array_from_vec(field1, &strings, field2, &ints))
});
let (field1, strings, field2, ints) = struct_array_values(256);
c.bench_function("struct_array_from_vec 256", |b| {
- b.iter(|| struct_array_from_vec(&field1, &strings, &field2, &ints))
+ b.iter(|| struct_array_from_vec(field1, &strings, field2, &ints))
});
let (field1, strings, field2, ints) = struct_array_values(512);
c.bench_function("struct_array_from_vec 512", |b| {
- b.iter(|| struct_array_from_vec(&field1, &strings, &field2, &ints))
+ b.iter(|| struct_array_from_vec(field1, &strings, field2, &ints))
});
let (field1, strings, field2, ints) = struct_array_values(1024);
c.bench_function("struct_array_from_vec 1024", |b| {
- b.iter(|| struct_array_from_vec(&field1, &strings, &field2, &ints))
+ b.iter(|| struct_array_from_vec(field1, &strings, field2, &ints))
});
}
diff --git a/arrow/benches/boolean_kernels.rs b/arrow/benches/boolean_kernels.rs
index e9394f7..ba085e2 100644
--- a/arrow/benches/boolean_kernels.rs
+++ b/arrow/benches/boolean_kernels.rs
@@ -35,7 +35,7 @@ fn bench_or(lhs: &BooleanArray, rhs: &BooleanArray) {
}
fn bench_not(array: &BooleanArray) {
- criterion::black_box(boolean_kernels::not(&array).unwrap());
+ criterion::black_box(boolean_kernels::not(array).unwrap());
}
fn add_benchmark(c: &mut Criterion) {
@@ -58,12 +58,12 @@ fn add_benchmark(c: &mut Criterion) {
.unwrap();
c.bench_function("and_sliced", |b| {
- b.iter(|| bench_and(&array1_slice, &array2_slice))
+ b.iter(|| bench_and(array1_slice, array2_slice))
});
c.bench_function("or_sliced", |b| {
- b.iter(|| bench_or(&array1_slice, &array2_slice))
+ b.iter(|| bench_or(array1_slice, array2_slice))
});
- c.bench_function("not_sliced", |b| b.iter(|| bench_not(&array1_slice)));
+ c.bench_function("not_sliced", |b| b.iter(|| bench_not(array1_slice)));
}
criterion_group!(benches, add_benchmark);
diff --git a/arrow/benches/filter_kernels.rs b/arrow/benches/filter_kernels.rs
index ca317b4..ca0b097 100644
--- a/arrow/benches/filter_kernels.rs
+++ b/arrow/benches/filter_kernels.rs
@@ -30,7 +30,7 @@ fn bench_filter(data_array: &dyn Array, filter_array: &BooleanArray) {
}
fn bench_built_filter<'a>(filter: &Filter<'a>, data: &impl Array) {
- criterion::black_box(filter(&data.data()));
+ criterion::black_box(filter(data.data()));
}
fn add_benchmark(c: &mut Criterion) {
diff --git a/arrow/benches/take_kernels.rs b/arrow/benches/take_kernels.rs
index 5de198b..dc9799b 100644
--- a/arrow/benches/take_kernels.rs
+++ b/arrow/benches/take_kernels.rs
@@ -43,12 +43,12 @@ fn create_random_index(size: usize, null_density: f32) -> UInt32Array {
}
fn bench_take(values: &dyn Array, indices: &UInt32Array) {
- criterion::black_box(take(values, &indices, None).unwrap());
+ criterion::black_box(take(values, indices, None).unwrap());
}
fn bench_take_bounds_check(values: &dyn Array, indices: &UInt32Array) {
criterion::black_box(
- take(values, &indices, Some(TakeOptions { check_bounds: true })).unwrap(),
+ take(values, indices, Some(TakeOptions { check_bounds: true })).unwrap(),
);
}
diff --git a/arrow/src/array/array.rs b/arrow/src/array/array.rs
index 3a4d90c..d715bc4 100644
--- a/arrow/src/array/array.rs
+++ b/arrow/src/array/array.rs
@@ -558,7 +558,7 @@ where
writeln!(f, " null,")?;
} else {
write!(f, " ")?;
- print_item(&array, i, f)?;
+ print_item(array, i, f)?;
writeln!(f, ",")?;
}
}
@@ -574,7 +574,7 @@ where
writeln!(f, " null,")?;
} else {
write!(f, " ")?;
- print_item(&array, i, f)?;
+ print_item(array, i, f)?;
writeln!(f, ",")?;
}
}
diff --git a/arrow/src/array/array_binary.rs b/arrow/src/array/array_binary.rs
index 6865ffd..22f52b6 100644
--- a/arrow/src/array/array_binary.rs
+++ b/arrow/src/array/array_binary.rs
@@ -174,7 +174,7 @@ impl<OffsetSize: BinaryOffsetSizeTrait> GenericBinaryArray<OffsetSize> {
impl<'a, T: BinaryOffsetSizeTrait> GenericBinaryArray<T> {
/// constructs a new iterator
pub fn iter(&'a self) -> GenericBinaryIter<'a, T> {
- GenericBinaryIter::<'a, T>::new(&self)
+ GenericBinaryIter::<'a, T>::new(self)
}
}
diff --git a/arrow/src/array/array_boolean.rs b/arrow/src/array/array_boolean.rs
index 40b0f90..d9c4480 100644
--- a/arrow/src/array/array_boolean.rs
+++ b/arrow/src/array/array_boolean.rs
@@ -167,7 +167,7 @@ impl<'a> IntoIterator for &'a BooleanArray {
impl<'a> BooleanArray {
/// constructs a new iterator
pub fn iter(&'a self) -> BooleanIter<'a> {
- BooleanIter::<'a>::new(&self)
+ BooleanIter::<'a>::new(self)
}
}
diff --git a/arrow/src/array/array_list.rs b/arrow/src/array/array_list.rs
index 24c0e63..94f87bb 100644
--- a/arrow/src/array/array_list.rs
+++ b/arrow/src/array/array_list.rs
@@ -110,7 +110,7 @@ impl<OffsetSize: OffsetSizeTrait> GenericListArray<OffsetSize> {
/// constructs a new iterator
pub fn iter<'a>(&'a self) -> GenericListArrayIter<'a, OffsetSize> {
- GenericListArrayIter::<'a, OffsetSize>::new(&self)
+ GenericListArrayIter::<'a, OffsetSize>::new(self)
}
#[inline]
diff --git a/arrow/src/array/array_primitive.rs b/arrow/src/array/array_primitive.rs
index e790a6a..0765629 100644
--- a/arrow/src/array/array_primitive.rs
+++ b/arrow/src/array/array_primitive.rs
@@ -299,7 +299,7 @@ impl<'a, T: ArrowPrimitiveType> IntoIterator for &'a PrimitiveArray<T> {
impl<'a, T: ArrowPrimitiveType> PrimitiveArray<T> {
/// constructs a new iterator
pub fn iter(&'a self) -> PrimitiveIter<'a, T> {
- PrimitiveIter::<'a, T>::new(&self)
+ PrimitiveIter::<'a, T>::new(self)
}
}
diff --git a/arrow/src/array/array_string.rs b/arrow/src/array/array_string.rs
index 301e386..93e1337 100644
--- a/arrow/src/array/array_string.rs
+++ b/arrow/src/array/array_string.rs
@@ -264,7 +264,7 @@ impl<'a, T: StringOffsetSizeTrait> IntoIterator for &'a GenericStringArray<T> {
impl<'a, T: StringOffsetSizeTrait> GenericStringArray<T> {
/// constructs a new iterator
pub fn iter(&'a self) -> GenericStringIter<'a, T> {
- GenericStringIter::<'a, T>::new(&self)
+ GenericStringIter::<'a, T>::new(self)
}
}
diff --git a/arrow/src/array/equal_json.rs b/arrow/src/array/equal_json.rs
index 043174b..7120e6c 100644
--- a/arrow/src/array/equal_json.rs
+++ b/arrow/src/array/equal_json.rs
@@ -66,7 +66,7 @@ impl JsonEqual for BooleanArray {
impl<T: ArrowPrimitiveType> PartialEq<Value> for PrimitiveArray<T> {
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(array) => self.equals_json_values(&array),
+ Value::Array(array) => self.equals_json_values(array),
_ => false,
}
}
@@ -75,7 +75,7 @@ impl<T: ArrowPrimitiveType> PartialEq<Value> for PrimitiveArray<T> {
impl<T: ArrowPrimitiveType> PartialEq<PrimitiveArray<T>> for Value {
fn eq(&self, arrow: &PrimitiveArray<T>) -> bool {
match self {
- Value::Array(array) => arrow.equals_json_values(&array),
+ Value::Array(array) => arrow.equals_json_values(array),
_ => false,
}
}
@@ -204,7 +204,7 @@ impl JsonEqual for StructArray {
impl PartialEq<Value> for StructArray {
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
@@ -213,7 +213,7 @@ impl PartialEq<Value> for StructArray {
impl PartialEq<StructArray> for Value {
fn eq(&self, arrow: &StructArray) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -244,7 +244,7 @@ impl<OffsetSize: BinaryOffsetSizeTrait> PartialEq<Value>
{
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
@@ -255,7 +255,7 @@ impl<OffsetSize: BinaryOffsetSizeTrait> PartialEq<GenericBinaryArray<OffsetSize>
{
fn eq(&self, arrow: &GenericBinaryArray<OffsetSize>) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -280,7 +280,7 @@ impl<OffsetSize: StringOffsetSizeTrait> PartialEq<Value>
{
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
@@ -291,7 +291,7 @@ impl<OffsetSize: StringOffsetSizeTrait> PartialEq<GenericStringArray<OffsetSize>
{
fn eq(&self, arrow: &GenericStringArray<OffsetSize>) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -320,7 +320,7 @@ impl JsonEqual for FixedSizeBinaryArray {
impl PartialEq<Value> for FixedSizeBinaryArray {
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
@@ -329,7 +329,7 @@ impl PartialEq<Value> for FixedSizeBinaryArray {
impl PartialEq<FixedSizeBinaryArray> for Value {
fn eq(&self, arrow: &FixedSizeBinaryArray) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -357,7 +357,7 @@ impl JsonEqual for DecimalArray {
impl PartialEq<Value> for DecimalArray {
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
@@ -366,7 +366,7 @@ impl PartialEq<Value> for DecimalArray {
impl PartialEq<DecimalArray> for Value {
fn eq(&self, arrow: &DecimalArray) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -394,7 +394,7 @@ impl JsonEqual for NullArray {
impl PartialEq<NullArray> for Value {
fn eq(&self, arrow: &NullArray) -> bool {
match self {
- Value::Array(json_array) => arrow.equals_json_values(&json_array),
+ Value::Array(json_array) => arrow.equals_json_values(json_array),
_ => false,
}
}
@@ -403,7 +403,7 @@ impl PartialEq<NullArray> for Value {
impl PartialEq<Value> for NullArray {
fn eq(&self, json: &Value) -> bool {
match json {
- Value::Array(json_array) => self.equals_json_values(&json_array),
+ Value::Array(json_array) => self.equals_json_values(json_array),
_ => false,
}
}
diff --git a/arrow/src/array/ord.rs b/arrow/src/array/ord.rs
index 323a882..d6534ef 100644
--- a/arrow/src/array/ord.rs
+++ b/arrow/src/array/ord.rs
@@ -77,7 +77,7 @@ where
let left: StringArray = StringArray::from(left.data().clone());
let right: StringArray = StringArray::from(right.data().clone());
- Box::new(move |i, j| left.value(i).cmp(&right.value(j)))
+ Box::new(move |i, j| left.value(i).cmp(right.value(j)))
}
fn compare_dict_string<T>(left: &dyn Array, right: &dyn Array) -> DynComparator
@@ -97,7 +97,7 @@ where
let key_right = right_keys.value(j).to_usize().unwrap();
let left = left_values.value(key_left);
let right = right_values.value(key_right);
- left.cmp(&right)
+ left.cmp(right)
})
}
diff --git a/arrow/src/buffer/immutable.rs b/arrow/src/buffer/immutable.rs
index f4aeae9..c00af6e 100644
--- a/arrow/src/buffer/immutable.rs
+++ b/arrow/src/buffer/immutable.rs
@@ -188,14 +188,14 @@ impl Buffer {
return self.slice(offset / 8);
}
- bitwise_unary_op_helper(&self, offset, len, |a| a)
+ bitwise_unary_op_helper(self, offset, len, |a| a)
}
/// Returns a `BitChunks` instance which can be used to iterate over this buffers bits
/// in larger chunks and starting at arbitrary bit offsets.
/// Note that both `offset` and `length` are measured in bits.
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks {
- BitChunks::new(&self.as_slice(), offset, len)
+ BitChunks::new(self.as_slice(), offset, len)
}
/// Returns the number of 1-bits in this buffer.
diff --git a/arrow/src/buffer/mod.rs b/arrow/src/buffer/mod.rs
index cc5c63b..d8f63958 100644
--- a/arrow/src/buffer/mod.rs
+++ b/arrow/src/buffer/mod.rs
@@ -39,7 +39,7 @@ impl<'a, 'b> BitAnd<&'b Buffer> for &'a Buffer {
}
let len_in_bits = self.len() * 8;
- Ok(buffer_bin_and(&self, 0, &rhs, 0, len_in_bits))
+ Ok(buffer_bin_and(self, 0, rhs, 0, len_in_bits))
}
}
@@ -55,7 +55,7 @@ impl<'a, 'b> BitOr<&'b Buffer> for &'a Buffer {
let len_in_bits = self.len() * 8;
- Ok(buffer_bin_or(&self, 0, &rhs, 0, len_in_bits))
+ Ok(buffer_bin_or(self, 0, rhs, 0, len_in_bits))
}
}
@@ -64,6 +64,6 @@ impl Not for &Buffer {
fn not(self) -> Buffer {
let len_in_bits = self.len() * 8;
- buffer_unary_not(&self, 0, len_in_bits)
+ buffer_unary_not(self, 0, len_in_bits)
}
}
diff --git a/arrow/src/buffer/ops.rs b/arrow/src/buffer/ops.rs
index 9d88149..c37fd14 100644
--- a/arrow/src/buffer/ops.rs
+++ b/arrow/src/buffer/ops.rs
@@ -287,7 +287,7 @@ pub fn buffer_bin_and(
len_in_bits: usize,
) -> Buffer {
bitwise_bin_op_helper(
- &left,
+ left,
left_offset_in_bits,
right,
right_offset_in_bits,
@@ -396,7 +396,7 @@ pub fn buffer_bin_or(
len_in_bits: usize,
) -> Buffer {
bitwise_bin_op_helper(
- &left,
+ left,
left_offset_in_bits,
right,
right_offset_in_bits,
@@ -424,6 +424,6 @@ pub fn buffer_unary_not(
// Default implementation
#[allow(unreachable_code)]
{
- bitwise_unary_op_helper(&left, offset_in_bits, len_in_bits, |a| !a)
+ bitwise_unary_op_helper(left, offset_in_bits, len_in_bits, |a| !a)
}
}
diff --git a/arrow/src/compute/kernels/aggregate.rs b/arrow/src/compute/kernels/aggregate.rs
index 2dd19c4..a385c67 100644
--- a/arrow/src/compute/kernels/aggregate.rs
+++ b/arrow/src/compute/kernels/aggregate.rs
@@ -48,7 +48,7 @@ fn min_max_string<T: StringOffsetSizeTrait, F: Fn(&str, &str) -> bool>(
n = array.value(0);
for i in 1..data.len() {
let item = array.value(i);
- if cmp(&n, item) {
+ if cmp(n, item) {
n = item;
}
}
@@ -58,7 +58,7 @@ fn min_max_string<T: StringOffsetSizeTrait, F: Fn(&str, &str) -> bool>(
for i in 0..data.len() {
let item = array.value(i);
- if data.is_valid(i) && (!has_value || cmp(&n, item)) {
+ if data.is_valid(i) && (!has_value || cmp(n, item)) {
has_value = true;
n = item;
}
diff --git a/arrow/src/compute/kernels/arithmetic.rs b/arrow/src/compute/kernels/arithmetic.rs
index e93ea51..5a6a87c 100644
--- a/arrow/src/compute/kernels/arithmetic.rs
+++ b/arrow/src/compute/kernels/arithmetic.rs
@@ -1083,7 +1083,7 @@ where
#[cfg(feature = "simd")]
return simd_modulus(&left, &right);
#[cfg(not(feature = "simd"))]
- return math_modulus(&left, &right);
+ return math_modulus(left, right);
}
/// Perform `left / right` operation on two arrays. If either left or right value is null
@@ -1106,7 +1106,7 @@ where
#[cfg(feature = "simd")]
return simd_divide(&left, &right);
#[cfg(not(feature = "simd"))]
- return math_divide(&left, &right);
+ return math_divide(left, right);
}
/// Modulus every value in an array by a scalar. If any value in the array is null then the
@@ -1129,7 +1129,7 @@ where
#[cfg(feature = "simd")]
return simd_modulus_scalar(&array, modulo);
#[cfg(not(feature = "simd"))]
- return math_modulus_scalar(&array, modulo);
+ return math_modulus_scalar(array, modulo);
}
/// Divide every value in an array by a scalar. If any value in the array is null then the
@@ -1152,7 +1152,7 @@ where
#[cfg(feature = "simd")]
return simd_divide_scalar(&array, divisor);
#[cfg(not(feature = "simd"))]
- return math_divide_scalar(&array, divisor);
+ return math_divide_scalar(array, divisor);
}
#[cfg(test)]
diff --git a/arrow/src/compute/kernels/boolean.rs b/arrow/src/compute/kernels/boolean.rs
index bab5f0f..57245fb 100644
--- a/arrow/src/compute/kernels/boolean.rs
+++ b/arrow/src/compute/kernels/boolean.rs
@@ -191,14 +191,14 @@ where
let left_data = left.data_ref();
let right_data = right.data_ref();
- let null_bit_buffer = combine_option_bitmap(&left_data, &right_data, len)?;
+ let null_bit_buffer = combine_option_bitmap(left_data, right_data, len)?;
let left_buffer = &left_data.buffers()[0];
let right_buffer = &right_data.buffers()[0];
let left_offset = left.offset();
let right_offset = right.offset();
- let values = op(&left_buffer, left_offset, &right_buffer, right_offset, len);
+ let values = op(left_buffer, left_offset, right_buffer, right_offset, len);
let data = ArrayData::new(
DataType::Boolean,
@@ -230,7 +230,7 @@ where
/// # }
/// ```
pub fn and(left: &BooleanArray, right: &BooleanArray) -> Result<BooleanArray> {
- binary_boolean_kernel(&left, &right, buffer_bin_and)
+ binary_boolean_kernel(left, right, buffer_bin_and)
}
/// Logical 'and' boolean values with Kleene logic
@@ -300,7 +300,7 @@ pub fn and_kleene(left: &BooleanArray, right: &BooleanArray) -> Result<BooleanAr
/// # }
/// ```
pub fn or(left: &BooleanArray, right: &BooleanArray) -> Result<BooleanArray> {
- binary_boolean_kernel(&left, &right, buffer_bin_or)
+ binary_boolean_kernel(left, right, buffer_bin_or)
}
/// Logical 'or' boolean values with Kleene logic
diff --git a/arrow/src/compute/kernels/cast.rs b/arrow/src/compute/kernels/cast.rs
index 50e9e16..661aad2 100644
--- a/arrow/src/compute/kernels/cast.rs
+++ b/arrow/src/compute/kernels/cast.rs
@@ -664,9 +664,9 @@ pub fn cast_with_options(
// temporal casts
(Int32, Date32) => cast_array_data::<Date32Type>(array, to_type.clone()),
(Int32, Date64) => cast_with_options(
- &cast_with_options(array, &DataType::Date32, &cast_options)?,
+ &cast_with_options(array, &DataType::Date32, cast_options)?,
&DataType::Date64,
- &cast_options,
+ cast_options,
),
(Int32, Time32(TimeUnit::Second)) => {
cast_array_data::<Time32SecondType>(array, to_type.clone())
@@ -679,14 +679,14 @@ pub fn cast_with_options(
(Date32, Int64) => cast_with_options(
&cast_with_options(array, &DataType::Int32, cast_options)?,
&DataType::Int64,
- &cast_options,
+ cast_options,
),
(Time32(_), Int32) => cast_array_data::<Int32Type>(array, to_type.clone()),
(Int64, Date64) => cast_array_data::<Date64Type>(array, to_type.clone()),
(Int64, Date32) => cast_with_options(
- &cast_with_options(array, &DataType::Int32, &cast_options)?,
+ &cast_with_options(array, &DataType::Int32, cast_options)?,
&DataType::Date32,
- &cast_options,
+ cast_options,
),
// No support for second/milliseconds with i64
(Int64, Time64(TimeUnit::Microsecond)) => {
@@ -698,9 +698,9 @@ pub fn cast_with_options(
(Date64, Int64) => cast_array_data::<Int64Type>(array, to_type.clone()),
(Date64, Int32) => cast_with_options(
- &cast_with_options(array, &DataType::Int64, &cast_options)?,
+ &cast_with_options(array, &DataType::Int64, cast_options)?,
&DataType::Int32,
- &cast_options,
+ cast_options,
),
(Time64(_), Int64) => cast_array_data::<Int64Type>(array, to_type.clone()),
(Date32, Date64) => {
@@ -746,8 +746,8 @@ pub fn cast_with_options(
let time_array = Int32Array::from(array.data().clone());
// note: (numeric_cast + SIMD multiply) is faster than (cast & multiply)
let c: Int64Array = numeric_cast(&time_array);
- let from_size = time_unit_multiple(&from_unit);
- let to_size = time_unit_multiple(&to_unit);
+ let from_size = time_unit_multiple(from_unit);
+ let to_size = time_unit_multiple(to_unit);
// from is only smaller than to if 64milli/64second don't exist
let mult = Int64Array::from(vec![to_size / from_size; array.len()]);
let converted = multiply(&c, &mult)?;
@@ -787,8 +787,8 @@ pub fn cast_with_options(
}
(Time64(from_unit), Time32(to_unit)) => {
let time_array = Int64Array::from(array.data().clone());
- let from_size = time_unit_multiple(&from_unit);
- let to_size = time_unit_multiple(&to_unit);
+ let from_size = time_unit_multiple(from_unit);
+ let to_size = time_unit_multiple(to_unit);
let divisor = from_size / to_size;
match to_unit {
TimeUnit::Second => {
@@ -824,8 +824,8 @@ pub fn cast_with_options(
}
(Timestamp(from_unit, _), Timestamp(to_unit, _)) => {
let time_array = Int64Array::from(array.data().clone());
- let from_size = time_unit_multiple(&from_unit);
- let to_size = time_unit_multiple(&to_unit);
+ let from_size = time_unit_multiple(from_unit);
+ let to_size = time_unit_multiple(to_unit);
// we either divide or multiply, depending on size of each unit
// units are never the same when the types are the same
let converted = if from_size >= to_size {
@@ -861,7 +861,7 @@ pub fn cast_with_options(
}
(Timestamp(from_unit, _), Date32) => {
let time_array = Int64Array::from(array.data().clone());
- let from_size = time_unit_multiple(&from_unit) * SECONDS_IN_DAY;
+ let from_size = time_unit_multiple(from_unit) * SECONDS_IN_DAY;
let mut b = Date32Builder::new(array.len());
for i in 0..array.len() {
if array.is_null(i) {
@@ -874,7 +874,7 @@ pub fn cast_with_options(
Ok(Arc::new(b.finish()) as ArrayRef)
}
(Timestamp(from_unit, _), Date64) => {
- let from_size = time_unit_multiple(&from_unit);
+ let from_size = time_unit_multiple(from_unit);
let to_size = MILLISECONDS;
// Scale time_array by (to_size / from_size) using a
@@ -1365,9 +1365,9 @@ fn dictionary_cast<K: ArrowDictionaryKeyType>(
let keys_array: ArrayRef =
Arc::new(PrimitiveArray::<K>::from(dict_array.keys().data().clone()));
let values_array = dict_array.values();
- let cast_keys = cast_with_options(&keys_array, to_index_type, &cast_options)?;
+ let cast_keys = cast_with_options(&keys_array, to_index_type, cast_options)?;
let cast_values =
- cast_with_options(values_array, to_value_type, &cast_options)?;
+ cast_with_options(values_array, to_value_type, cast_options)?;
// Failure to cast keys (because they don't fit in the
// target type) results in NULL values;
@@ -1439,8 +1439,7 @@ where
// attempt to cast the dict values to the target type
// use the take kernel to expand out the dictionary
- let cast_dict_values =
- cast_with_options(&dict_array.values(), to_type, cast_options)?;
+ let cast_dict_values = cast_with_options(dict_array.values(), to_type, cast_options)?;
// Note take requires first casting the indices to u32
let keys_array: ArrayRef =
@@ -1531,7 +1530,7 @@ where
V: ArrowNumericType,
{
// attempt to cast the source array values to the target value type (the dictionary values type)
- let cast_values = cast_with_options(array, &dict_value_type, cast_options)?;
+ let cast_values = cast_with_options(array, dict_value_type, cast_options)?;
let values = cast_values
.as_any()
.downcast_ref::<PrimitiveArray<V>>()
diff --git a/arrow/src/compute/kernels/filter.rs b/arrow/src/compute/kernels/filter.rs
index 4a5cce7..075943c 100644
--- a/arrow/src/compute/kernels/filter.rs
+++ b/arrow/src/compute/kernels/filter.rs
@@ -292,7 +292,7 @@ pub fn filter_record_batch(
let filtered_arrays = record_batch
.columns()
.iter()
- .map(|a| make_array(filter(&a.data())))
+ .map(|a| make_array(filter(a.data())))
.collect();
RecordBatch::try_new(record_batch.schema(), filtered_arrays)
}
diff --git a/arrow/src/compute/kernels/sort.rs b/arrow/src/compute/kernels/sort.rs
index 53217fe..463fbde 100644
--- a/arrow/src/compute/kernels/sort.rs
+++ b/arrow/src/compute/kernels/sort.rs
@@ -628,7 +628,7 @@ fn sort_string_dictionary<T: ArrowDictionaryKeyType>(
let keys: &PrimitiveArray<T> = values.keys();
let dict = values.values();
- let dict: &StringArray = as_string_array(&dict);
+ let dict: &StringArray = as_string_array(dict);
sort_string_helper(
keys,
@@ -658,7 +658,7 @@ where
{
let mut valids = value_indices
.into_iter()
- .map(|index| (index, value_fn(&values, index)))
+ .map(|index| (index, value_fn(values, index)))
.collect::<Vec<(u32, &str)>>();
let mut nulls = null_indices;
let descending = options.descending;
diff --git a/arrow/src/compute/util.rs b/arrow/src/compute/util.rs
index 56de594..6d4d0e4 100644
--- a/arrow/src/compute/util.rs
+++ b/arrow/src/compute/util.rs
@@ -48,9 +48,9 @@ pub(super) fn combine_option_bitmap(
None => Ok(Some(l.bit_slice(left_offset_in_bits, len_in_bits))),
Some(r) => Ok(Some(buffer_bin_and(
- &l,
+ l,
left_offset_in_bits,
- &r,
+ r,
right_offset_in_bits,
len_in_bits,
))),
@@ -82,9 +82,9 @@ pub(super) fn compare_option_bitmap(
None => Ok(Some(l.bit_slice(left_offset_in_bits, len_in_bits))),
Some(r) => Ok(Some(buffer_bin_or(
- &l,
+ l,
left_offset_in_bits,
- &r,
+ r,
right_offset_in_bits,
len_in_bits,
))),
diff --git a/arrow/src/csv/reader.rs b/arrow/src/csv/reader.rs
index d41676b..7bd12eb 100644
--- a/arrow/src/csv/reader.rs
+++ b/arrow/src/csv/reader.rs
@@ -236,7 +236,7 @@ fn infer_reader_schema_with_csv_options<R: Read>(
match possibilities.len() {
1 => {
for dtype in possibilities.iter() {
- fields.push(Field::new(&field_name, dtype.clone(), has_nulls));
+ fields.push(Field::new(field_name, dtype.clone(), has_nulls));
}
}
2 => {
@@ -244,13 +244,13 @@ fn infer_reader_schema_with_csv_options<R: Read>(
&& possibilities.contains(&DataType::Float64)
{
// we have an integer and double, fall down to double
- fields.push(Field::new(&field_name, DataType::Float64, has_nulls));
+ fields.push(Field::new(field_name, DataType::Float64, has_nulls));
} else {
// default to Utf8 for conflicting datatypes (e.g bool and int)
- fields.push(Field::new(&field_name, DataType::Utf8, has_nulls));
+ fields.push(Field::new(field_name, DataType::Utf8, has_nulls));
}
}
- _ => fields.push(Field::new(&field_name, DataType::Utf8, has_nulls)),
+ _ => fields.push(Field::new(field_name, DataType::Utf8, has_nulls)),
}
}
@@ -480,7 +480,7 @@ impl<R: Read> Iterator for Reader<R> {
// parse the batches into a RecordBatch
let result = parse(
&self.batch_records[..read_records],
- &self.schema.fields(),
+ self.schema.fields(),
Some(self.schema.metadata.clone()),
&self.projection,
self.line_number,
diff --git a/arrow/src/csv/writer.rs b/arrow/src/csv/writer.rs
index b3b8838..c6e49f0 100644
--- a/arrow/src/csv/writer.rs
+++ b/arrow/src/csv/writer.rs
@@ -279,7 +279,7 @@ impl<W: Write> Writer<W> {
.iter()
.map(|array| match array.data_type() {
DataType::Dictionary(_, value_type) => {
- crate::compute::kernels::cast::cast(array, &value_type)
+ crate::compute::kernels::cast::cast(array, value_type)
.expect("cannot cast dictionary to underlying values")
}
_ => array.clone(),
diff --git a/arrow/src/datatypes/field.rs b/arrow/src/datatypes/field.rs
index a471f12..1cb8eb8 100644
--- a/arrow/src/datatypes/field.rs
+++ b/arrow/src/datatypes/field.rs
@@ -408,7 +408,7 @@ impl Field {
continue;
}
is_new_field = false;
- self_field.try_merge(&from_field)?;
+ self_field.try_merge(from_field)?;
}
if is_new_field {
nested_fields.push(from_field.clone());
diff --git a/arrow/src/ipc/reader.rs b/arrow/src/ipc/reader.rs
index b28e048..7bba311 100644
--- a/arrow/src/ipc/reader.rs
+++ b/arrow/src/ipc/reader.rs
@@ -429,7 +429,7 @@ pub fn read_record_batch(
let triple = create_array(
field_nodes,
field.data_type(),
- &buf,
+ buf,
buffers,
dictionaries,
node_index,
@@ -475,10 +475,10 @@ pub fn read_dictionary(
};
// Read a single column
let record_batch = read_record_batch(
- &buf,
+ buf,
batch.data().unwrap(),
Arc::new(schema),
- &dictionaries_by_field,
+ dictionaries_by_field,
)?;
Some(record_batch.column(0).clone())
}
diff --git a/arrow/src/ipc/writer.rs b/arrow/src/ipc/writer.rs
index a6df7b8..f342d67 100644
--- a/arrow/src/ipc/writer.rs
+++ b/arrow/src/ipc/writer.rs
@@ -190,7 +190,7 @@ impl IpcDataGenerator {
for array in batch.columns() {
let array_data = array.data();
offset = write_array_data(
- &array_data,
+ array_data,
&mut buffers,
&mut arrow_data,
&mut nodes,
@@ -243,7 +243,7 @@ impl IpcDataGenerator {
let mut arrow_data: Vec<u8> = vec![];
write_array_data(
- &array_data,
+ array_data,
&mut buffers,
&mut arrow_data,
&mut nodes,
@@ -628,7 +628,7 @@ pub fn write_message<W: Write>(
write_continuation(
&mut writer,
- &write_options,
+ write_options,
(aligned_size - prefix_size) as i32,
)?;
diff --git a/arrow/src/json/writer.rs b/arrow/src/json/writer.rs
index 8587c1d..eb1f79f 100644
--- a/arrow/src/json/writer.rs
+++ b/arrow/src/json/writer.rs
@@ -482,7 +482,7 @@ fn set_column_for_json_rows(
}
DataType::Dictionary(_, value_type) => {
let slice = array.slice(0, row_count);
- let hydrated = crate::compute::kernels::cast::cast(&slice, &value_type)
+ let hydrated = crate::compute::kernels::cast::cast(&slice, value_type)
.expect("cannot cast dictionary to underlying values");
set_column_for_json_rows(rows, row_count, &hydrated, col_name)
}
diff --git a/arrow/src/tensor.rs b/arrow/src/tensor.rs
index 3a81338..b8d07f8 100644
--- a/arrow/src/tensor.rs
+++ b/arrow/src/tensor.rs
@@ -196,7 +196,7 @@ impl<'a, T: ArrowPrimitiveType> Tensor<'a, T> {
names: Option<Vec<&'a str>>,
) -> Result<Self> {
if let Some(ref s) = shape {
- let strides = Some(compute_row_major_strides::<T>(&s)?);
+ let strides = Some(compute_row_major_strides::<T>(s)?);
Self::try_new(buffer, shape, strides, names)
} else {
@@ -213,7 +213,7 @@ impl<'a, T: ArrowPrimitiveType> Tensor<'a, T> {
names: Option<Vec<&'a str>>,
) -> Result<Self> {
if let Some(ref s) = shape {
- let strides = Some(compute_column_major_strides::<T>(&s)?);
+ let strides = Some(compute_column_major_strides::<T>(s)?);
Self::try_new(buffer, shape, strides, names)
} else {
@@ -258,7 +258,7 @@ impl<'a, T: ArrowPrimitiveType> Tensor<'a, T> {
/// The name of dimension i
pub fn dim_name(&self, i: usize) -> Option<&'a str> {
- self.names.as_ref().map(|ref names| names[i])
+ self.names.as_ref().map(|names| names[i])
}
/// The total number of elements in the `Tensor`
diff --git a/arrow/src/util/display.rs b/arrow/src/util/display.rs
index a65cb5f..fbc0bd5 100644
--- a/arrow/src/util/display.rs
+++ b/arrow/src/util/display.rs
@@ -361,5 +361,5 @@ fn dict_array_value_to_string<K: ArrowPrimitiveType>(
))
})?;
- array_value_to_string(&dict_array.values(), dict_index)
+ array_value_to_string(dict_array.values(), dict_index)
}
diff --git a/arrow/src/util/integration_util.rs b/arrow/src/util/integration_util.rs
index 2403151..bac0e47 100644
--- a/arrow/src/util/integration_util.rs
+++ b/arrow/src/util/integration_util.rs
@@ -217,7 +217,7 @@ impl ArrowJsonBatch {
if &col.name != field.name() {
return false;
}
- let json_array: Vec<Value> = json_from_col(&col, field.data_type());
+ let json_array: Vec<Value> = json_from_col(col, field.data_type());
match field.data_type() {
DataType::Null => {
let arr: &NullArray =
diff --git a/parquet/src/arrow/arrow_array_reader.rs b/parquet/src/arrow/arrow_array_reader.rs
index c06d872..06f1efb 100644
--- a/parquet/src/arrow/arrow_array_reader.rs
+++ b/parquet/src/arrow/arrow_array_reader.rs
@@ -311,7 +311,7 @@ impl<'a, C: ArrayConverter + 'a> ArrowArrayReader<'a, C> {
let mut buffer_ptr = buf;
// create rep level decoder iterator
let rep_level_iter: Box<dyn ValueDecoder> =
- if Self::rep_levels_available(&column_desc) {
+ if Self::rep_levels_available(column_desc) {
let mut rep_decoder = LevelDecoder::v1(
rep_level_encoding,
column_desc.max_rep_level(),
@@ -328,7 +328,7 @@ impl<'a, C: ArrayConverter + 'a> ArrowArrayReader<'a, C> {
};
// create def level decoder iterator
let def_level_iter: Box<dyn ValueDecoder> =
- if Self::def_levels_available(&column_desc) {
+ if Self::def_levels_available(column_desc) {
let mut def_decoder = LevelDecoder::v1(
def_level_encoding,
column_desc.max_def_level(),
@@ -367,7 +367,7 @@ impl<'a, C: ArrayConverter + 'a> ArrowArrayReader<'a, C> {
let mut offset = 0;
// create rep level decoder iterator
let rep_level_iter: Box<dyn ValueDecoder> =
- if Self::rep_levels_available(&column_desc) {
+ if Self::rep_levels_available(column_desc) {
let rep_levels_byte_len = rep_levels_byte_len as usize;
let mut rep_decoder =
LevelDecoder::v2(column_desc.max_rep_level());
@@ -386,7 +386,7 @@ impl<'a, C: ArrayConverter + 'a> ArrowArrayReader<'a, C> {
};
// create def level decoder iterator
let def_level_iter: Box<dyn ValueDecoder> =
- if Self::def_levels_available(&column_desc) {
+ if Self::def_levels_available(column_desc) {
let def_levels_byte_len = def_levels_byte_len as usize;
let mut def_decoder =
LevelDecoder::v2(column_desc.max_def_level());
diff --git a/parquet/src/arrow/arrow_writer.rs b/parquet/src/arrow/arrow_writer.rs
index 03868a3..3ff1304 100644
--- a/parquet/src/arrow/arrow_writer.rs
+++ b/parquet/src/arrow/arrow_writer.rs
@@ -250,7 +250,7 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::Int32Array>()
.expect("Unable to get int32 array");
- get_numeric_array_slice::<Int32Type, _>(&array, &indices)
+ get_numeric_array_slice::<Int32Type, _>(array, &indices)
}
ArrowDataType::UInt32 => {
// follow C++ implementation and use overflow/reinterpret cast from u32 to i32 which will map
@@ -271,7 +271,7 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::Int32Array>()
.expect("Unable to get i32 array");
- get_numeric_array_slice::<Int32Type, _>(&array, &indices)
+ get_numeric_array_slice::<Int32Type, _>(array, &indices)
}
};
typed.write_batch(
@@ -286,7 +286,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::BooleanArray>()
.expect("Unable to get boolean array");
typed.write_batch(
- get_bool_array_slice(&array, &indices).as_slice(),
+ get_bool_array_slice(array, &indices).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -298,7 +298,7 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::Int64Array>()
.expect("Unable to get i64 array");
- get_numeric_array_slice::<Int64Type, _>(&array, &indices)
+ get_numeric_array_slice::<Int64Type, _>(array, &indices)
}
ArrowDataType::UInt64 => {
// follow C++ implementation and use overflow/reinterpret cast from u64 to i64 which will map
@@ -319,7 +319,7 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::Int64Array>()
.expect("Unable to get i64 array");
- get_numeric_array_slice::<Int64Type, _>(&array, &indices)
+ get_numeric_array_slice::<Int64Type, _>(array, &indices)
}
};
typed.write_batch(
@@ -337,7 +337,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::Float32Array>()
.expect("Unable to get Float32 array");
typed.write_batch(
- get_numeric_array_slice::<FloatType, _>(&array, &indices).as_slice(),
+ get_numeric_array_slice::<FloatType, _>(array, &indices).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -348,7 +348,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::Float64Array>()
.expect("Unable to get Float64 array");
typed.write_batch(
- get_numeric_array_slice::<DoubleType, _>(&array, &indices).as_slice(),
+ get_numeric_array_slice::<DoubleType, _>(array, &indices).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -360,7 +360,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::BinaryArray>()
.expect("Unable to get BinaryArray array");
typed.write_batch(
- get_binary_array(&array).as_slice(),
+ get_binary_array(array).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -371,7 +371,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::StringArray>()
.expect("Unable to get LargeBinaryArray array");
typed.write_batch(
- get_string_array(&array).as_slice(),
+ get_string_array(array).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -382,7 +382,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::LargeBinaryArray>()
.expect("Unable to get LargeBinaryArray array");
typed.write_batch(
- get_large_binary_array(&array).as_slice(),
+ get_large_binary_array(array).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -393,7 +393,7 @@ fn write_leaf(
.downcast_ref::<arrow_array::LargeStringArray>()
.expect("Unable to get LargeUtf8 array");
typed.write_batch(
- get_large_string_array(&array).as_slice(),
+ get_large_string_array(array).as_slice(),
Some(levels.definition.as_slice()),
levels.repetition.as_deref(),
)?
@@ -408,14 +408,14 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::IntervalYearMonthArray>()
.unwrap();
- get_interval_ym_array_slice(&array, &indices)
+ get_interval_ym_array_slice(array, &indices)
}
IntervalUnit::DayTime => {
let array = column
.as_any()
.downcast_ref::<arrow_array::IntervalDayTimeArray>()
.unwrap();
- get_interval_dt_array_slice(&array, &indices)
+ get_interval_dt_array_slice(array, &indices)
}
},
ArrowDataType::FixedSizeBinary(_) => {
@@ -423,14 +423,14 @@ fn write_leaf(
.as_any()
.downcast_ref::<arrow_array::FixedSizeBinaryArray>()
.unwrap();
- get_fsb_array_slice(&array, &indices)
+ get_fsb_array_slice(array, &indices)
}
ArrowDataType::Decimal(_, _) => {
let array = column
.as_any()
.downcast_ref::<arrow_array::DecimalArray>()
.unwrap();
- get_decimal_array_slice(&array, &indices)
+ get_decimal_array_slice(array, &indices)
}
_ => {
return Err(ParquetError::NYI(
diff --git a/parquet/src/arrow/schema.rs b/parquet/src/arrow/schema.rs
index 6c04b70..18dacd1 100644
--- a/parquet/src/arrow/schema.rs
+++ b/parquet/src/arrow/schema.rs
@@ -216,7 +216,7 @@ fn get_arrow_schema_from_metadata(encoded_meta: &str) -> Result<Schema> {
fn encode_arrow_schema(schema: &Schema) -> String {
let options = writer::IpcWriteOptions::default();
let data_gen = arrow::ipc::writer::IpcDataGenerator::default();
- let mut serialized_schema = data_gen.schema_to_bytes(&schema, &options);
+ let mut serialized_schema = data_gen.schema_to_bytes(schema, &options);
// manually prepending the length to the schema as arrow uses the legacy IPC format
// TODO: change after addressing ARROW-9777
diff --git a/parquet/src/column/page.rs b/parquet/src/column/page.rs
index b75d3b5..acbf3eb 100644
--- a/parquet/src/column/page.rs
+++ b/parquet/src/column/page.rs
@@ -70,9 +70,9 @@ impl Page {
/// Returns internal byte buffer reference for this page.
pub fn buffer(&self) -> &ByteBufferPtr {
match self {
- Page::DataPage { ref buf, .. } => &buf,
- Page::DataPageV2 { ref buf, .. } => &buf,
- Page::DictionaryPage { ref buf, .. } => &buf,
+ Page::DataPage { ref buf, .. } => buf,
+ Page::DataPageV2 { ref buf, .. } => buf,
+ Page::DictionaryPage { ref buf, .. } => buf,
}
}
diff --git a/parquet/src/column/writer.rs b/parquet/src/column/writer.rs
index 910a9ed..d5b8457 100644
--- a/parquet/src/column/writer.rs
+++ b/parquet/src/column/writer.rs
@@ -807,7 +807,7 @@ impl<T: DataType> ColumnWriterImpl<T> {
) -> Result<Vec<u8>> {
let size = max_buffer_size(encoding, max_level, levels.len());
let mut encoder = LevelEncoder::v1(encoding, max_level, vec![0; size]);
- encoder.put(&levels)?;
+ encoder.put(levels)?;
encoder.consume()
}
@@ -817,7 +817,7 @@ impl<T: DataType> ColumnWriterImpl<T> {
fn encode_levels_v2(&self, levels: &[i16], max_level: i16) -> Result<Vec<u8>> {
let size = max_buffer_size(Encoding::RLE, max_level, levels.len());
let mut encoder = LevelEncoder::v2(max_level, vec![0; size]);
- encoder.put(&levels)?;
+ encoder.put(levels)?;
encoder.consume()
}
diff --git a/parquet/src/encodings/encoding.rs b/parquet/src/encodings/encoding.rs
index d042738..f452618 100644
--- a/parquet/src/encodings/encoding.rs
+++ b/parquet/src/encodings/encoding.rs
@@ -359,7 +359,7 @@ impl<T: DataType> Encoder<T> for DictEncoder<T> {
#[inline]
fn put(&mut self, values: &[T::T]) -> Result<()> {
for i in values {
- self.put_one(&i)?
+ self.put_one(i)?
}
Ok(())
}
diff --git a/parquet/src/file/metadata.rs b/parquet/src/file/metadata.rs
index 150c42c..ca5a823 100644
--- a/parquet/src/file/metadata.rs
+++ b/parquet/src/file/metadata.rs
@@ -359,8 +359,8 @@ impl ColumnChunkMetaData {
///
/// If not set, assumed to belong to the same file as the metadata.
/// This path is relative to the current file.
- pub fn file_path(&self) -> Option<&String> {
- self.file_path.as_ref()
+ pub fn file_path(&self) -> Option<&str> {
+ self.file_path.as_deref()
}
/// Byte offset in `file_path()`.
@@ -520,7 +520,7 @@ impl ColumnChunkMetaData {
};
ColumnChunk {
- file_path: self.file_path().cloned(),
+ file_path: self.file_path().map(|s| s.to_owned()),
file_offset: self.file_offset,
meta_data: Some(column_metadata),
offset_index_offset: None,
diff --git a/parquet/src/file/serialized_reader.rs b/parquet/src/file/serialized_reader.rs
index 688272c..056b754 100644
--- a/parquet/src/file/serialized_reader.rs
+++ b/parquet/src/file/serialized_reader.rs
@@ -199,7 +199,7 @@ impl<'a, R: ChunkReader> SerializedRowGroupReader<'a, R> {
impl<'a, R: 'static + ChunkReader> RowGroupReader for SerializedRowGroupReader<'a, R> {
fn metadata(&self) -> &RowGroupMetaData {
- &self.metadata
+ self.metadata
}
fn num_columns(&self) -> usize {
diff --git a/parquet/src/schema/printer.rs b/parquet/src/schema/printer.rs
index b1e739f..c19c95d 100644
--- a/parquet/src/schema/printer.rs
+++ b/parquet/src/schema/printer.rs
@@ -55,7 +55,7 @@ use crate::schema::types::Type;
/// information.
#[allow(unused_must_use)]
pub fn print_parquet_metadata(out: &mut dyn io::Write, metadata: &ParquetMetaData) {
- print_file_metadata(out, &metadata.file_metadata());
+ print_file_metadata(out, metadata.file_metadata());
writeln!(out);
writeln!(out);
writeln!(out, "num of row groups: {}", metadata.num_row_groups());
@@ -133,10 +133,7 @@ fn print_column_chunk_metadata(
.map(|e| format!("{}", e))
.collect();
writeln!(out, "encodings: {}", encoding_strs.join(" "));
- let file_path_str = match cc_metadata.file_path() {
- None => "N/A",
- Some(ref fp) => *fp,
- };
+ let file_path_str = cc_metadata.file_path().unwrap_or("N/A");
writeln!(out, "file path: {}", file_path_str);
writeln!(out, "file offset: {}", cc_metadata.file_offset());
writeln!(out, "num of values: {}", cc_metadata.num_values());
@@ -340,7 +337,7 @@ impl<'a> Printer<'a> {
self.indent += INDENT_WIDTH;
for c in fields {
- self.print(&c);
+ self.print(c);
writeln!(self.output);
}
self.indent -= INDENT_WIDTH;
diff --git a/parquet/src/schema/types.rs b/parquet/src/schema/types.rs
index 1aa8c26..d885ff1 100644
--- a/parquet/src/schema/types.rs
+++ b/parquet/src/schema/types.rs
@@ -72,8 +72,8 @@ impl Type {
/// Returns [`BasicTypeInfo`] information about the type.
pub fn get_basic_info(&self) -> &BasicTypeInfo {
match *self {
- Type::PrimitiveType { ref basic_info, .. } => &basic_info,
- Type::GroupType { ref basic_info, .. } => &basic_info,
+ Type::PrimitiveType { ref basic_info, .. } => basic_info,
+ Type::GroupType { ref basic_info, .. } => basic_info,
}
}