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 4481993a0 Fix clippy lints (#2414) (#2415)
4481993a0 is described below

commit 4481993a0421e686f9767848843a0fb0370a78b1
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Thu Aug 11 20:22:39 2022 +0100

    Fix clippy lints (#2414) (#2415)
---
 arrow-flight/src/lib.rs                 |  1 +
 arrow/src/compute/kernels/zip.rs        |  2 +-
 arrow/src/json/reader.rs                |  2 +-
 object_store/src/lib.rs                 |  2 +-
 parquet/src/basic.rs                    | 14 +++++++-------
 parquet/src/errors.rs                   |  2 +-
 parquet/src/file/page_encoding_stats.rs |  2 +-
 parquet/src/file/properties.rs          |  2 +-
 parquet/src/file/serialized_reader.rs   | 14 ++++++++------
 parquet/src/schema/types.rs             |  2 +-
 10 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/arrow-flight/src/lib.rs b/arrow-flight/src/lib.rs
index 5cfbd3f60..3f4f09855 100644
--- a/arrow-flight/src/lib.rs
+++ b/arrow-flight/src/lib.rs
@@ -28,6 +28,7 @@ use std::{
     ops::Deref,
 };
 
+#[allow(clippy::derive_partial_eq_without_eq)]
 mod gen {
     include!("arrow.flight.protocol.rs");
 }
diff --git a/arrow/src/compute/kernels/zip.rs b/arrow/src/compute/kernels/zip.rs
index 0ee8e47be..c28529cf6 100644
--- a/arrow/src/compute/kernels/zip.rs
+++ b/arrow/src/compute/kernels/zip.rs
@@ -44,7 +44,7 @@ pub fn zip(
     let falsy = falsy.data();
     let truthy = truthy.data();
 
-    let mut mutable = MutableArrayData::new(vec![&*truthy, &*falsy], false, 
truthy.len());
+    let mut mutable = MutableArrayData::new(vec![truthy, falsy], false, 
truthy.len());
 
     // the SlicesIterator slices only the true values. So the gaps left by 
this iterator we need to
     // fill with falsy values
diff --git a/arrow/src/json/reader.rs b/arrow/src/json/reader.rs
index 9b348e629..66fdc6918 100644
--- a/arrow/src/json/reader.rs
+++ b/arrow/src/json/reader.rs
@@ -590,7 +590,7 @@ pub struct Decoder {
     options: DecoderOptions,
 }
 
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 /// Options for JSON decoding
 pub struct DecoderOptions {
     /// Batch size (number of records to load each time), defaults to 1024 
records
diff --git a/object_store/src/lib.rs b/object_store/src/lib.rs
index 57e1371e6..f7adedb26 100644
--- a/object_store/src/lib.rs
+++ b/object_store/src/lib.rs
@@ -313,7 +313,7 @@ pub struct ListResult {
 }
 
 /// The metadata that describes an object.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub struct ObjectMeta {
     /// The full path to the object
     pub location: Path,
diff --git a/parquet/src/basic.rs b/parquet/src/basic.rs
index 9c58f764c..7adbc8c1b 100644
--- a/parquet/src/basic.rs
+++ b/parquet/src/basic.rs
@@ -63,7 +63,7 @@ pub enum Type {
 ///
 /// This struct was renamed from `LogicalType` in version 4.0.0.
 /// If targeting Parquet format 2.4.0 or above, please use [LogicalType] 
instead.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum ConvertedType {
     NONE,
@@ -165,7 +165,7 @@ pub enum ConvertedType {
 /// This is an *entirely new* struct as of version
 /// 4.0.0. The struct previously named `LogicalType` was renamed to
 /// [`ConvertedType`]. Please see the README.md for more details.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub enum LogicalType {
     String,
     Map,
@@ -198,7 +198,7 @@ pub enum LogicalType {
 // Mirrors `parquet::FieldRepetitionType`
 
 /// Representation of field types in schema.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum Repetition {
     /// Field is required (can not be null) and each record has exactly 1 
value.
@@ -281,7 +281,7 @@ pub enum Encoding {
 // Mirrors `parquet::CompressionCodec`
 
 /// Supported compression algorithms.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 pub enum Compression {
     UNCOMPRESSED,
     SNAPPY,
@@ -297,7 +297,7 @@ pub enum Compression {
 
 /// Available data pages for Parquet file format.
 /// Note that some of the page types may not be supported.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum PageType {
     DATA_PAGE,
@@ -317,7 +317,7 @@ pub enum PageType {
 ///
 /// See reference in
 /// <https://github.com/apache/parquet-cpp/blob/master/src/parquet/types.h>
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum SortOrder {
     /// Signed (either value or legacy byte-wise) comparison.
@@ -333,7 +333,7 @@ pub enum SortOrder {
 ///
 /// If column order is undefined, then it is the legacy behaviour and all 
values should
 /// be compared as signed values/bytes.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum ColumnOrder {
     /// Column uses the order defined by its logical or physical type
diff --git a/parquet/src/errors.rs b/parquet/src/errors.rs
index 683784193..c4f5faaaa 100644
--- a/parquet/src/errors.rs
+++ b/parquet/src/errors.rs
@@ -22,7 +22,7 @@ use std::{cell, io, result, str};
 #[cfg(any(feature = "arrow", test))]
 use arrow::error::ArrowError;
 
-#[derive(Debug, PartialEq, Clone)]
+#[derive(Debug, PartialEq, Clone, Eq)]
 pub enum ParquetError {
     /// General Parquet error.
     /// Returned when code violates normal workflow of working with Parquet 
files.
diff --git a/parquet/src/file/page_encoding_stats.rs 
b/parquet/src/file/page_encoding_stats.rs
index 3180c7820..e499a094a 100644
--- a/parquet/src/file/page_encoding_stats.rs
+++ b/parquet/src/file/page_encoding_stats.rs
@@ -21,7 +21,7 @@ use parquet_format::{
 };
 
 /// PageEncodingStats for a column chunk and data page.
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
 pub struct PageEncodingStats {
     /// the page type (data/dic/...)
     pub page_type: PageType,
diff --git a/parquet/src/file/properties.rs b/parquet/src/file/properties.rs
index c96439820..57dae323d 100644
--- a/parquet/src/file/properties.rs
+++ b/parquet/src/file/properties.rs
@@ -68,7 +68,7 @@ const DEFAULT_CREATED_BY: &str = env!("PARQUET_CREATED_BY");
 /// Parquet writer version.
 ///
 /// Basic constant, which is not part of the Thrift definition.
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 #[allow(non_camel_case_types)]
 pub enum WriterVersion {
     PARQUET_1_0,
diff --git a/parquet/src/file/serialized_reader.rs 
b/parquet/src/file/serialized_reader.rs
index 045410d03..0b7451f4b 100644
--- a/parquet/src/file/serialized_reader.rs
+++ b/parquet/src/file/serialized_reader.rs
@@ -138,12 +138,17 @@ pub struct SerializedFileReader<R: ChunkReader> {
     metadata: ParquetMetaData,
 }
 
+/// A predicate for filtering row groups, invoked with the metadata and index
+/// of each row group in the file. Only row groups for which the predicate
+/// evaluates to `true` will be scanned
+pub type ReadGroupPredicate = Box<dyn FnMut(&RowGroupMetaData, usize) -> bool>;
+
 /// A builder for [`ReadOptions`].
 /// For the predicates that are added to the builder,
 /// they will be chained using 'AND' to filter the row groups.
 #[derive(Default)]
 pub struct ReadOptionsBuilder {
-    predicates: Vec<Box<dyn FnMut(&RowGroupMetaData, usize) -> bool>>,
+    predicates: Vec<ReadGroupPredicate>,
     enable_page_index: bool,
 }
 
@@ -155,10 +160,7 @@ impl ReadOptionsBuilder {
 
     /// Add a predicate on row group metadata to the reading option,
     /// Filter only row groups that match the predicate criteria
-    pub fn with_predicate(
-        mut self,
-        predicate: Box<dyn FnMut(&RowGroupMetaData, usize) -> bool>,
-    ) -> Self {
+    pub fn with_predicate(mut self, predicate: ReadGroupPredicate) -> Self {
         self.predicates.push(predicate);
         self
     }
@@ -195,7 +197,7 @@ impl ReadOptionsBuilder {
 /// Currently, only predicates on row group metadata are supported.
 /// All predicates will be chained using 'AND' to filter the row groups.
 pub struct ReadOptions {
-    predicates: Vec<Box<dyn FnMut(&RowGroupMetaData, usize) -> bool>>,
+    predicates: Vec<ReadGroupPredicate>,
     enable_page_index: bool,
 }
 
diff --git a/parquet/src/schema/types.rs b/parquet/src/schema/types.rs
index 8d624fe3d..823803167 100644
--- a/parquet/src/schema/types.rs
+++ b/parquet/src/schema/types.rs
@@ -593,7 +593,7 @@ impl<'a> GroupTypeBuilder<'a> {
 
 /// Basic type info. This contains information such as the name of the type,
 /// the repetition level, the logical type and the kind of the type (group, 
primitive).
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
 pub struct BasicTypeInfo {
     name: String,
     repetition: Option<Repetition>,

Reply via email to