diff --git a/datafusion/catalog/src/catalog.rs b/datafusion/catalog/src/catalog.rs index 048a7f14ed37..85f2dede2f27 100644 --- a/datafusion/catalog/src/catalog.rs +++ b/datafusion/catalog/src/catalog.rs @@ -101,7 +101,6 @@ use datafusion_common::Result; /// [`UnityCatalogProvider`]: https://github.com/delta-io/delta-rs/blob/951436ecec476ce65b5ed3b58b50fb0846ca7b91/crates/deltalake-core/src/data_catalog/unity/datafusion.rs#L111-L123 /// /// [`TableProvider`]: crate::TableProvider - pub trait CatalogProvider: Debug + Sync + Send { /// Returns the catalog provider as [`Any`] /// so that it can be downcast to a specific implementation. diff --git a/datafusion/common/src/column.rs b/datafusion/common/src/column.rs index c47ed2815906..d940bcf3146e 100644 --- a/datafusion/common/src/column.rs +++ b/datafusion/common/src/column.rs @@ -109,21 +109,23 @@ impl Column { /// where `"foo.BAR"` would be parsed to a reference to column named `foo.BAR` pub fn from_qualified_name(flat_name: impl Into) -> Self { let flat_name = flat_name.into(); - Self::from_idents(&mut parse_identifiers_normalized(&flat_name, false)) - .unwrap_or_else(|| Self { + Self::from_idents(&mut parse_identifiers_normalized(&flat_name, false)).unwrap_or( + Self { relation: None, name: flat_name, - }) + }, + ) } /// Deserialize a fully qualified name string into a column preserving column text case pub fn from_qualified_name_ignore_case(flat_name: impl Into) -> Self { let flat_name = flat_name.into(); - Self::from_idents(&mut parse_identifiers_normalized(&flat_name, true)) - .unwrap_or_else(|| Self { + Self::from_idents(&mut parse_identifiers_normalized(&flat_name, true)).unwrap_or( + Self { relation: None, name: flat_name, - }) + }, + ) } /// return the column's name. diff --git a/datafusion/common/src/hash_utils.rs b/datafusion/common/src/hash_utils.rs index f1b3947f9976..0d1d93acf1fc 100644 --- a/datafusion/common/src/hash_utils.rs +++ b/datafusion/common/src/hash_utils.rs @@ -63,7 +63,7 @@ pub trait HashValue { fn hash_one(&self, state: &RandomState) -> u64; } -impl<'a, T: HashValue + ?Sized> HashValue for &'a T { +impl HashValue for &T { fn hash_one(&self, state: &RandomState) -> u64 { T::hash_one(self, state) } diff --git a/datafusion/common/src/utils/mod.rs b/datafusion/common/src/utils/mod.rs index d4c427aaa4a9..850ea84f142e 100644 --- a/datafusion/common/src/utils/mod.rs +++ b/datafusion/common/src/utils/mod.rs @@ -319,8 +319,6 @@ pub fn longest_consecutive_prefix>( count } -/// Array Utils - /// Wrap an array into a single element `ListArray`. /// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]` /// The field in the list array is nullable. @@ -328,8 +326,6 @@ pub fn array_into_list_array_nullable(arr: ArrayRef) -> ListArray { array_into_list_array(arr, true) } -/// Array Utils - /// Wrap an array into a single element `ListArray`. /// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]` pub fn array_into_list_array(arr: ArrayRef, nullable: bool) -> ListArray { @@ -569,7 +565,7 @@ pub mod datafusion_strsim { struct StringWrapper<'a>(&'a str); - impl<'a, 'b> IntoIterator for &'a StringWrapper<'b> { + impl<'b> IntoIterator for &StringWrapper<'b> { type Item = char; type IntoIter = Chars<'b>; diff --git a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs index 9f089c7c0cea..f3358bce7623 100644 --- a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs +++ b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs @@ -60,7 +60,7 @@ pub struct AvroArrowArrayReader<'a, R: Read> { schema_lookup: BTreeMap, } -impl<'a, R: Read> AvroArrowArrayReader<'a, R> { +impl AvroArrowArrayReader<'_, R> { pub fn try_new( reader: R, schema: SchemaRef, diff --git a/datafusion/core/src/datasource/avro_to_arrow/reader.rs b/datafusion/core/src/datasource/avro_to_arrow/reader.rs index e6310cec7475..dbc24da46366 100644 --- a/datafusion/core/src/datasource/avro_to_arrow/reader.rs +++ b/datafusion/core/src/datasource/avro_to_arrow/reader.rs @@ -128,7 +128,7 @@ pub struct Reader<'a, R: Read> { batch_size: usize, } -impl<'a, R: Read> Reader<'a, R> { +impl Reader<'_, R> { /// Create a new Avro Reader from any value that implements the `Read` trait. /// /// If reading a `File`, you can customise the Reader, such as to enable schema @@ -157,7 +157,7 @@ impl<'a, R: Read> Reader<'a, R> { } } -impl<'a, R: Read> Iterator for Reader<'a, R> { +impl Iterator for Reader<'_, R> { type Item = ArrowResult; /// Returns the next batch of results (defined by `self.batch_size`), or `None` if there diff --git a/datafusion/core/src/datasource/file_format/options.rs b/datafusion/core/src/datasource/file_format/options.rs index e392515cacb1..95576f448c64 100644 --- a/datafusion/core/src/datasource/file_format/options.rs +++ b/datafusion/core/src/datasource/file_format/options.rs @@ -89,7 +89,7 @@ pub struct CsvReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for CsvReadOptions<'a> { +impl Default for CsvReadOptions<'_> { fn default() -> Self { Self::new() } @@ -243,7 +243,7 @@ pub struct ParquetReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for ParquetReadOptions<'a> { +impl Default for ParquetReadOptions<'_> { fn default() -> Self { Self { file_extension: DEFAULT_PARQUET_EXTENSION, @@ -323,7 +323,7 @@ pub struct ArrowReadOptions<'a> { pub table_partition_cols: Vec<(String, DataType)>, } -impl<'a> Default for ArrowReadOptions<'a> { +impl Default for ArrowReadOptions<'_> { fn default() -> Self { Self { schema: None, @@ -368,7 +368,7 @@ pub struct AvroReadOptions<'a> { pub table_partition_cols: Vec<(String, DataType)>, } -impl<'a> Default for AvroReadOptions<'a> { +impl Default for AvroReadOptions<'_> { fn default() -> Self { Self { schema: None, @@ -420,7 +420,7 @@ pub struct NdJsonReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for NdJsonReadOptions<'a> { +impl Default for NdJsonReadOptions<'_> { fn default() -> Self { Self { schema: None, diff --git a/datafusion/core/src/datasource/file_format/parquet.rs b/datafusion/core/src/datasource/file_format/parquet.rs index 787af4f531bd..1d08de172273 100644 --- a/datafusion/core/src/datasource/file_format/parquet.rs +++ b/datafusion/core/src/datasource/file_format/parquet.rs @@ -477,7 +477,7 @@ impl<'a> ObjectStoreFetch<'a> { } } -impl<'a> MetadataFetch for ObjectStoreFetch<'a> { +impl MetadataFetch for ObjectStoreFetch<'_> { fn fetch( &mut self, range: Range, diff --git a/datafusion/core/src/datasource/listing/helpers.rs b/datafusion/core/src/datasource/listing/helpers.rs index 04c64156b125..a601aec32f16 100644 --- a/datafusion/core/src/datasource/listing/helpers.rs +++ b/datafusion/core/src/datasource/listing/helpers.rs @@ -135,7 +135,7 @@ pub fn split_files( partitioned_files.sort_by(|a, b| a.path().cmp(b.path())); // effectively this is div with rounding up instead of truncating - let chunk_size = (partitioned_files.len() + n - 1) / n; + let chunk_size = partitioned_files.len().div_ceil(n); let mut chunks = Vec::with_capacity(n); let mut current_chunk = Vec::with_capacity(chunk_size); for file in partitioned_files.drain(..) { diff --git a/datafusion/core/src/datasource/physical_plan/file_groups.rs b/datafusion/core/src/datasource/physical_plan/file_groups.rs index 28f975ae193d..f9a19f1d9691 100644 --- a/datafusion/core/src/datasource/physical_plan/file_groups.rs +++ b/datafusion/core/src/datasource/physical_plan/file_groups.rs @@ -217,8 +217,7 @@ impl FileGroupPartitioner { return None; } - let target_partition_size = - (total_size as usize + (target_partitions) - 1) / (target_partitions); + let target_partition_size = (total_size as usize).div_ceil(target_partitions); let current_partition_index: usize = 0; let current_partition_size: usize = 0; diff --git a/datafusion/core/src/datasource/physical_plan/mod.rs b/datafusion/core/src/datasource/physical_plan/mod.rs index 2b50458bb581..449b7bb43519 100644 --- a/datafusion/core/src/datasource/physical_plan/mod.rs +++ b/datafusion/core/src/datasource/physical_plan/mod.rs @@ -139,7 +139,7 @@ impl DisplayAs for FileScanConfig { #[derive(Debug)] struct FileGroupsDisplay<'a>(&'a [Vec]); -impl<'a> DisplayAs for FileGroupsDisplay<'a> { +impl DisplayAs for FileGroupsDisplay<'_> { fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult { let n_groups = self.0.len(); let groups = if n_groups == 1 { "group" } else { "groups" }; @@ -171,7 +171,7 @@ impl<'a> DisplayAs for FileGroupsDisplay<'a> { #[derive(Debug)] pub(crate) struct FileGroupDisplay<'a>(pub &'a [PartitionedFile]); -impl<'a> DisplayAs for FileGroupDisplay<'a> { +impl DisplayAs for FileGroupDisplay<'_> { fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult { write!(f, "[")?; match t { diff --git a/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs index 07f50bca1d1d..4d0a8451a0d4 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs @@ -449,7 +449,7 @@ impl<'a> PagesPruningStatistics<'a> { Some(vec) } } -impl<'a> PruningStatistics for PagesPruningStatistics<'a> { +impl PruningStatistics for PagesPruningStatistics<'_> { fn min_values(&self, _column: &datafusion_common::Column) -> Option { match self.converter.data_page_mins( self.column_index, diff --git a/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs index a97e7c7d2552..af5ffb9d5743 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs @@ -336,7 +336,7 @@ impl<'schema> PushdownChecker<'schema> { } } -impl<'schema> TreeNodeRewriter for PushdownChecker<'schema> { +impl TreeNodeRewriter for PushdownChecker<'_> { type Node = Arc; fn f_down( diff --git a/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs index 7406676652f6..516310dc81ae 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs @@ -374,7 +374,7 @@ impl<'a> RowGroupPruningStatistics<'a> { } } -impl<'a> PruningStatistics for RowGroupPruningStatistics<'a> { +impl PruningStatistics for RowGroupPruningStatistics<'_> { fn min_values(&self, column: &Column) -> Option { self.statistics_converter(column) .and_then(|c| Ok(c.row_group_mins(self.metadata_iter())?)) diff --git a/datafusion/core/src/execution/context/mod.rs b/datafusion/core/src/execution/context/mod.rs index 5f01d41c31e7..8ec834916424 100644 --- a/datafusion/core/src/execution/context/mod.rs +++ b/datafusion/core/src/execution/context/mod.rs @@ -1764,7 +1764,7 @@ impl<'a> BadPlanVisitor<'a> { } } -impl<'n, 'a> TreeNodeVisitor<'n> for BadPlanVisitor<'a> { +impl<'n> TreeNodeVisitor<'n> for BadPlanVisitor<'_> { type Node = LogicalPlan; fn f_down(&mut self, node: &'n Self::Node) -> Result { diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index e99cf8222381..e2be3cf3749e 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -1636,7 +1636,7 @@ struct SessionContextProvider<'a> { tables: HashMap>, } -impl<'a> ContextProvider for SessionContextProvider<'a> { +impl ContextProvider for SessionContextProvider<'_> { fn get_expr_planners(&self) -> &[Arc] { &self.state.expr_planners } @@ -1931,7 +1931,7 @@ impl<'a> SessionSimplifyProvider<'a> { } } -impl<'a> SimplifyInfo for SessionSimplifyProvider<'a> { +impl SimplifyInfo for SessionSimplifyProvider<'_> { fn is_boolean_type(&self, expr: &Expr) -> datafusion_common::Result { Ok(expr.get_type(self.df_schema)? == DataType::Boolean) } diff --git a/datafusion/core/src/physical_optimizer/test_utils.rs b/datafusion/core/src/physical_optimizer/test_utils.rs index 88bb0b6fef23..9156301393c0 100644 --- a/datafusion/core/src/physical_optimizer/test_utils.rs +++ b/datafusion/core/src/physical_optimizer/test_utils.rs @@ -17,6 +17,8 @@ //! Collection of testing utility functions that are leveraged by the query optimizer rules +#![allow(missing_docs)] + use std::any::Any; use std::fmt::Formatter; use std::sync::Arc; diff --git a/datafusion/core/src/test/mod.rs b/datafusion/core/src/test/mod.rs index 9ac75c8f3efb..d8304c2f0a86 100644 --- a/datafusion/core/src/test/mod.rs +++ b/datafusion/core/src/test/mod.rs @@ -17,6 +17,8 @@ //! Common unit test utility methods +#![allow(missing_docs)] + use std::any::Any; use std::fs::File; use std::io::prelude::*; diff --git a/datafusion/execution/src/cache/mod.rs b/datafusion/execution/src/cache/mod.rs index da19bff5658a..4271bebd0b32 100644 --- a/datafusion/execution/src/cache/mod.rs +++ b/datafusion/execution/src/cache/mod.rs @@ -22,7 +22,6 @@ pub mod cache_unit; /// This interface does not get `mut` references and thus has to handle its own /// locking via internal mutability. It can be accessed via multiple concurrent queries /// during planning and execution. - pub trait CacheAccessor: Send + Sync { // Extra info but not part of the cache key or cache value. type Extra: Clone; diff --git a/datafusion/expr-common/src/type_coercion/aggregates.rs b/datafusion/expr-common/src/type_coercion/aggregates.rs index 384d688cc27e..13d52959aba6 100644 --- a/datafusion/expr-common/src/type_coercion/aggregates.rs +++ b/datafusion/expr-common/src/type_coercion/aggregates.rs @@ -294,19 +294,19 @@ pub fn coerce_avg_type(func_name: &str, arg_types: &[DataType]) -> Result Result { - return match &data_type { + match &data_type { DataType::Decimal128(p, s) => Ok(DataType::Decimal128(*p, *s)), DataType::Decimal256(p, s) => Ok(DataType::Decimal256(*p, *s)), d if d.is_numeric() => Ok(DataType::Float64), - DataType::Dictionary(_, v) => return coerced_type(func_name, v.as_ref()), + DataType::Dictionary(_, v) => coerced_type(func_name, v.as_ref()), _ => { - return plan_err!( + plan_err!( "The function {:?} does not support inputs of type {:?}.", func_name, data_type ) } - }; + } } Ok(vec![coerced_type(func_name, &arg_types[0])?]) } diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs index 2e316f11dde7..c495b5396f53 100644 --- a/datafusion/expr/src/expr.rs +++ b/datafusion/expr/src/expr.rs @@ -1852,7 +1852,7 @@ macro_rules! expr_vec_fmt { } struct SchemaDisplay<'a>(&'a Expr); -impl<'a> Display for SchemaDisplay<'a> { +impl Display for SchemaDisplay<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self.0 { // The same as Display diff --git a/datafusion/expr/src/logical_plan/ddl.rs b/datafusion/expr/src/logical_plan/ddl.rs index 8c64a017988e..3efaf296c29c 100644 --- a/datafusion/expr/src/logical_plan/ddl.rs +++ b/datafusion/expr/src/logical_plan/ddl.rs @@ -125,7 +125,7 @@ impl DdlStatement { /// See [crate::LogicalPlan::display] for an example pub fn display(&self) -> impl Display + '_ { struct Wrapper<'a>(&'a DdlStatement); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.0 { DdlStatement::CreateExternalTable(CreateExternalTable { diff --git a/datafusion/expr/src/logical_plan/display.rs b/datafusion/expr/src/logical_plan/display.rs index b808defcb959..14758b61e859 100644 --- a/datafusion/expr/src/logical_plan/display.rs +++ b/datafusion/expr/src/logical_plan/display.rs @@ -59,7 +59,7 @@ impl<'a, 'b> IndentVisitor<'a, 'b> { } } -impl<'n, 'a, 'b> TreeNodeVisitor<'n> for IndentVisitor<'a, 'b> { +impl<'n> TreeNodeVisitor<'n> for IndentVisitor<'_, '_> { type Node = LogicalPlan; fn f_down( @@ -113,7 +113,7 @@ impl<'n, 'a, 'b> TreeNodeVisitor<'n> for IndentVisitor<'a, 'b> { pub fn display_schema(schema: &Schema) -> impl fmt::Display + '_ { struct Wrapper<'a>(&'a Schema); - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "[")?; for (idx, field) in self.0.fields().iter().enumerate() { @@ -181,7 +181,7 @@ impl<'a, 'b> GraphvizVisitor<'a, 'b> { } } -impl<'n, 'a, 'b> TreeNodeVisitor<'n> for GraphvizVisitor<'a, 'b> { +impl<'n> TreeNodeVisitor<'n> for GraphvizVisitor<'_, '_> { type Node = LogicalPlan; fn f_down( @@ -654,7 +654,7 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> { } } -impl<'n, 'a, 'b> TreeNodeVisitor<'n> for PgJsonVisitor<'a, 'b> { +impl<'n> TreeNodeVisitor<'n> for PgJsonVisitor<'_, '_> { type Node = LogicalPlan; fn f_down( diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index e9f4f1f80972..e2590a9f255c 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -1536,7 +1536,7 @@ impl LogicalPlan { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let with_schema = false; let mut visitor = IndentVisitor::new(f, with_schema); @@ -1579,7 +1579,7 @@ impl LogicalPlan { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let with_schema = true; let mut visitor = IndentVisitor::new(f, with_schema); @@ -1599,7 +1599,7 @@ impl LogicalPlan { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = PgJsonVisitor::new(f); visitor.with_schema(true); @@ -1645,7 +1645,7 @@ impl LogicalPlan { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = GraphvizVisitor::new(f); @@ -1696,7 +1696,7 @@ impl LogicalPlan { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self.0 { LogicalPlan::EmptyRelation(_) => write!(f, "EmptyRelation"), diff --git a/datafusion/expr/src/logical_plan/statement.rs b/datafusion/expr/src/logical_plan/statement.rs index 26df379f5e4a..a8b53e8a1fb1 100644 --- a/datafusion/expr/src/logical_plan/statement.rs +++ b/datafusion/expr/src/logical_plan/statement.rs @@ -85,7 +85,7 @@ impl Statement { /// See [crate::LogicalPlan::display] for an example pub fn display(&self) -> impl Display + '_ { struct Wrapper<'a>(&'a Statement); - impl<'a> Display for Wrapper<'a> { + impl Display for Wrapper<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.0 { Statement::TransactionStart(TransactionStart { diff --git a/datafusion/expr/src/simplify.rs b/datafusion/expr/src/simplify.rs index e636fabf10fb..467ce8bf53e2 100644 --- a/datafusion/expr/src/simplify.rs +++ b/datafusion/expr/src/simplify.rs @@ -71,7 +71,7 @@ impl<'a> SimplifyContext<'a> { } } -impl<'a> SimplifyInfo for SimplifyContext<'a> { +impl SimplifyInfo for SimplifyContext<'_> { /// Returns true if this Expr has boolean type fn is_boolean_type(&self, expr: &Expr) -> Result { if let Some(schema) = &self.schema { diff --git a/datafusion/functions-aggregate-common/src/merge_arrays.rs b/datafusion/functions-aggregate-common/src/merge_arrays.rs index 544bdc182829..9b9a1240c1a1 100644 --- a/datafusion/functions-aggregate-common/src/merge_arrays.rs +++ b/datafusion/functions-aggregate-common/src/merge_arrays.rs @@ -65,7 +65,7 @@ impl<'a> CustomElement<'a> { // Overwrite ordering implementation such that // - `self.ordering` values are used for comparison, // - When used inside `BinaryHeap` it is a min-heap. -impl<'a> Ord for CustomElement<'a> { +impl Ord for CustomElement<'_> { fn cmp(&self, other: &Self) -> Ordering { // Compares according to custom ordering self.ordering(&self.ordering, &other.ordering) @@ -78,7 +78,7 @@ impl<'a> Ord for CustomElement<'a> { } } -impl<'a> PartialOrd for CustomElement<'a> { +impl PartialOrd for CustomElement<'_> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } diff --git a/datafusion/functions-nested/src/concat.rs b/datafusion/functions-nested/src/concat.rs index 0b7056858d7e..ac9b5b2a16ef 100644 --- a/datafusion/functions-nested/src/concat.rs +++ b/datafusion/functions-nested/src/concat.rs @@ -438,7 +438,7 @@ fn concat_internal(args: &[ArrayRef]) -> Result { Ok(Arc::new(list_arr)) } -/// Kernal functions +// Kernel functions /// Array_append SQL function pub(crate) fn array_append_inner(args: &[ArrayRef]) -> Result { diff --git a/datafusion/functions-nested/src/map.rs b/datafusion/functions-nested/src/map.rs index e49391379817..d21a19c9fb33 100644 --- a/datafusion/functions-nested/src/map.rs +++ b/datafusion/functions-nested/src/map.rs @@ -373,7 +373,6 @@ fn get_element_type(data_type: &DataType) -> Result<&DataType> { /// | +-------+ | | +-------+ | /// +-----------+ +-----------+ /// ```text - fn make_map_array_internal( keys: ArrayRef, values: ArrayRef, diff --git a/datafusion/functions-nested/src/planner.rs b/datafusion/functions-nested/src/planner.rs index 1929b8222a1b..5ca51ac20f1e 100644 --- a/datafusion/functions-nested/src/planner.rs +++ b/datafusion/functions-nested/src/planner.rs @@ -185,5 +185,5 @@ impl ExprPlanner for FieldAccessPlanner { } fn is_array_agg(agg_func: &datafusion_expr::expr::AggregateFunction) -> bool { - return agg_func.func.name() == "array_agg"; + agg_func.func.name() == "array_agg" } diff --git a/datafusion/functions/src/strings.rs b/datafusion/functions/src/strings.rs index e0cec3cb5756..d2fb5d58519e 100644 --- a/datafusion/functions/src/strings.rs +++ b/datafusion/functions/src/strings.rs @@ -395,7 +395,7 @@ pub enum ColumnarValueRef<'a> { NonNullableStringViewArray(&'a StringViewArray), } -impl<'a> ColumnarValueRef<'a> { +impl ColumnarValueRef<'_> { #[inline] pub fn is_valid(&self, i: usize) -> bool { match &self { diff --git a/datafusion/optimizer/src/analyzer/type_coercion.rs b/datafusion/optimizer/src/analyzer/type_coercion.rs index f088a6dc5691..58e390ee8bdb 100644 --- a/datafusion/optimizer/src/analyzer/type_coercion.rs +++ b/datafusion/optimizer/src/analyzer/type_coercion.rs @@ -290,7 +290,7 @@ impl<'a> TypeCoercionRewriter<'a> { } } -impl<'a> TreeNodeRewriter for TypeCoercionRewriter<'a> { +impl TreeNodeRewriter for TypeCoercionRewriter<'_> { type Node = Expr; fn f_up(&mut self, expr: Expr) -> Result> { diff --git a/datafusion/optimizer/src/join_key_set.rs b/datafusion/optimizer/src/join_key_set.rs index c0eec78b183d..0a97173b3096 100644 --- a/datafusion/optimizer/src/join_key_set.rs +++ b/datafusion/optimizer/src/join_key_set.rs @@ -148,7 +148,7 @@ impl<'a> ExprPair<'a> { } } -impl<'a> Equivalent<(Expr, Expr)> for ExprPair<'a> { +impl Equivalent<(Expr, Expr)> for ExprPair<'_> { fn equivalent(&self, other: &(Expr, Expr)) -> bool { self.0 == &other.0 && self.1 == &other.1 } diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs index 975150cd6122..dfdd0c110c22 100644 --- a/datafusion/optimizer/src/optimizer.rs +++ b/datafusion/optimizer/src/optimizer.rs @@ -68,7 +68,6 @@ use crate::utils::log_plan; /// /// [`AnalyzerRule`]: crate::analyzer::AnalyzerRule /// [`SessionState::add_optimizer_rule`]: https://docs.rs/datafusion/latest/datafusion/execution/session_state/struct.SessionState.html#method.add_optimizer_rule - pub trait OptimizerRule: Debug { /// Try and rewrite `plan` to an optimized form, returning None if the plan /// cannot be optimized by this rule. @@ -302,7 +301,7 @@ impl<'a> Rewriter<'a> { } } -impl<'a> TreeNodeRewriter for Rewriter<'a> { +impl TreeNodeRewriter for Rewriter<'_> { type Node = LogicalPlan; fn f_down(&mut self, node: LogicalPlan) -> Result> { diff --git a/datafusion/optimizer/src/replace_distinct_aggregate.rs b/datafusion/optimizer/src/replace_distinct_aggregate.rs index f3e1673e7211..48b2828faf45 100644 --- a/datafusion/optimizer/src/replace_distinct_aggregate.rs +++ b/datafusion/optimizer/src/replace_distinct_aggregate.rs @@ -54,8 +54,6 @@ use datafusion_expr::{Aggregate, Distinct, DistinctOn, Expr, LogicalPlan}; /// ) /// ORDER BY a DESC /// ``` - -/// Optimizer that replaces logical [[Distinct]] with a logical [[Aggregate]] #[derive(Default, Debug)] pub struct ReplaceDistinctWithAggregate {} diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs index 6564e722eaf8..60de3f6b3673 100644 --- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs +++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs @@ -489,7 +489,7 @@ enum ConstSimplifyResult { SimplifyRuntimeError(DataFusionError, Expr), } -impl<'a> TreeNodeRewriter for ConstEvaluator<'a> { +impl TreeNodeRewriter for ConstEvaluator<'_> { type Node = Expr; fn f_down(&mut self, expr: Expr) -> Result> { @@ -710,7 +710,7 @@ impl<'a, S> Simplifier<'a, S> { } } -impl<'a, S: SimplifyInfo> TreeNodeRewriter for Simplifier<'a, S> { +impl TreeNodeRewriter for Simplifier<'_, S> { type Node = Expr; /// rewrite the expression simplifying any constant expressions diff --git a/datafusion/optimizer/src/simplify_expressions/guarantees.rs b/datafusion/optimizer/src/simplify_expressions/guarantees.rs index afcbe528083b..4700ab97b5f3 100644 --- a/datafusion/optimizer/src/simplify_expressions/guarantees.rs +++ b/datafusion/optimizer/src/simplify_expressions/guarantees.rs @@ -57,7 +57,7 @@ impl<'a> GuaranteeRewriter<'a> { } } -impl<'a> TreeNodeRewriter for GuaranteeRewriter<'a> { +impl TreeNodeRewriter for GuaranteeRewriter<'_> { type Node = Expr; fn f_up(&mut self, expr: Expr) -> Result> { diff --git a/datafusion/physical-expr-common/src/binary_view_map.rs b/datafusion/physical-expr-common/src/binary_view_map.rs index 4148c5ffa7c7..7ce943030a45 100644 --- a/datafusion/physical-expr-common/src/binary_view_map.rs +++ b/datafusion/physical-expr-common/src/binary_view_map.rs @@ -114,7 +114,6 @@ impl ArrowBytesViewSet { /// This map is used by the special `COUNT DISTINCT` aggregate function to /// store the distinct values, and by the `GROUP BY` operator to store /// group values when they are a single string array. - pub struct ArrowBytesViewMap where V: Debug + PartialEq + Eq + Clone + Copy + Default, diff --git a/datafusion/physical-expr-common/src/physical_expr.rs b/datafusion/physical-expr-common/src/physical_expr.rs index aa816cfa4469..8ab7030dd8a1 100644 --- a/datafusion/physical-expr-common/src/physical_expr.rs +++ b/datafusion/physical-expr-common/src/physical_expr.rs @@ -219,7 +219,7 @@ pub fn with_new_children_if_necessary( /// Example output: `[a + 1, b]` pub fn format_physical_expr_list(exprs: &[Arc]) -> impl Display + '_ { struct DisplayWrapper<'a>(&'a [Arc]); - impl<'a> Display for DisplayWrapper<'a> { + impl Display for DisplayWrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let mut iter = self.0.iter(); write!(f, "[")?; diff --git a/datafusion/physical-expr-common/src/sort_expr.rs b/datafusion/physical-expr-common/src/sort_expr.rs index 9ae12fa9f608..bf06296ba3e2 100644 --- a/datafusion/physical-expr-common/src/sort_expr.rs +++ b/datafusion/physical-expr-common/src/sort_expr.rs @@ -251,7 +251,7 @@ pub fn format_physical_sort_requirement_list( exprs: &[PhysicalSortRequirement], ) -> impl Display + '_ { struct DisplayWrapper<'a>(&'a [PhysicalSortRequirement]); - impl<'a> Display for DisplayWrapper<'a> { + impl Display for DisplayWrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let mut iter = self.0.iter(); write!(f, "[")?; diff --git a/datafusion/physical-expr/src/equivalence/class.rs b/datafusion/physical-expr/src/equivalence/class.rs index e4185ad44d65..9e00b756b42a 100644 --- a/datafusion/physical-expr/src/equivalence/class.rs +++ b/datafusion/physical-expr/src/equivalence/class.rs @@ -125,7 +125,7 @@ impl ConstExpr { /// Returns a [`Display`]able list of `ConstExpr`. pub fn format_list(input: &[ConstExpr]) -> impl Display + '_ { struct DisplayableList<'a>(&'a [ConstExpr]); - impl<'a> Display for DisplayableList<'a> { + impl Display for DisplayableList<'_> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { let mut first = true; for const_expr in self.0 { diff --git a/datafusion/physical-expr/src/expressions/in_list.rs b/datafusion/physical-expr/src/expressions/in_list.rs index 663045fcad3f..29577740aab4 100644 --- a/datafusion/physical-expr/src/expressions/in_list.rs +++ b/datafusion/physical-expr/src/expressions/in_list.rs @@ -244,7 +244,7 @@ trait IsEqual: HashValue { fn is_equal(&self, other: &Self) -> bool; } -impl<'a, T: IsEqual + ?Sized> IsEqual for &'a T { +impl IsEqual for &T { fn is_equal(&self, other: &Self) -> bool { T::is_equal(self, other) } diff --git a/datafusion/physical-expr/src/utils/guarantee.rs b/datafusion/physical-expr/src/utils/guarantee.rs index 2c37c4d8b394..75ad5d22afe6 100644 --- a/datafusion/physical-expr/src/utils/guarantee.rs +++ b/datafusion/physical-expr/src/utils/guarantee.rs @@ -124,7 +124,7 @@ impl LiteralGuarantee { // for an `AND` conjunction to be true, all terms individually must be true .fold(GuaranteeBuilder::new(), |builder, expr| { if let Some(cel) = ColOpLit::try_new(expr) { - return builder.aggregate_conjunct(cel); + builder.aggregate_conjunct(cel) } else if let Some(inlist) = expr .as_any() .downcast_ref::() diff --git a/datafusion/physical-expr/src/utils/mod.rs b/datafusion/physical-expr/src/utils/mod.rs index e4b8b133a315..c06efd554098 100644 --- a/datafusion/physical-expr/src/utils/mod.rs +++ b/datafusion/physical-expr/src/utils/mod.rs @@ -146,9 +146,7 @@ struct PhysicalExprDAEGBuilder<'a, T, F: Fn(&ExprTreeNode) -> Result< constructor: &'a F, } -impl<'a, T, F: Fn(&ExprTreeNode) -> Result> - PhysicalExprDAEGBuilder<'a, T, F> -{ +impl) -> Result> PhysicalExprDAEGBuilder<'_, T, F> { // This method mutates an expression node by transforming it to a physical expression // and adding it to the graph. The method returns the mutated expression node. fn mutate( diff --git a/datafusion/physical-plan/src/aggregates/topk/heap.rs b/datafusion/physical-plan/src/aggregates/topk/heap.rs index 61569e511a88..ec1277f8fd55 100644 --- a/datafusion/physical-plan/src/aggregates/topk/heap.rs +++ b/datafusion/physical-plan/src/aggregates/topk/heap.rs @@ -367,7 +367,7 @@ impl TopKHeap { impl Display for TopKHeap { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let mut output = String::new(); - if self.heap.first().is_some() { + if !self.heap.is_empty() { self._tree_print(0, String::new(), true, &mut output); } write!(f, "{}", output) diff --git a/datafusion/physical-plan/src/display.rs b/datafusion/physical-plan/src/display.rs index 9f3a76e28577..9c5e95d56e60 100644 --- a/datafusion/physical-plan/src/display.rs +++ b/datafusion/physical-plan/src/display.rs @@ -124,7 +124,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_statistics: bool, show_schema: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = IndentVisitor { t: self.format_type, @@ -163,7 +163,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_metrics: ShowMetrics, show_statistics: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let t = DisplayFormatType::Default; @@ -202,7 +202,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_schema: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = IndentVisitor { f, @@ -268,7 +268,7 @@ struct IndentVisitor<'a, 'b> { show_schema: bool, } -impl<'a, 'b> ExecutionPlanVisitor for IndentVisitor<'a, 'b> { +impl ExecutionPlanVisitor for IndentVisitor<'_, '_> { type Error = fmt::Error; fn pre_visit(&mut self, plan: &dyn ExecutionPlan) -> Result { write!(self.f, "{:indent$}", "", indent = self.indent * 2)?; @@ -349,7 +349,7 @@ impl ExecutionPlanVisitor for GraphvizVisitor<'_, '_> { struct Wrapper<'a>(&'a dyn ExecutionPlan, DisplayFormatType); - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { self.0.fmt_as(self.1, f) } @@ -447,7 +447,7 @@ impl fmt::Display for VerboseDisplay { #[derive(Debug)] pub struct ProjectSchemaDisplay<'a>(pub &'a SchemaRef); -impl<'a> fmt::Display for ProjectSchemaDisplay<'a> { +impl fmt::Display for ProjectSchemaDisplay<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let parts: Vec<_> = self .0 diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs index 8ab292c14269..f7bf039ee7b5 100644 --- a/datafusion/physical-plan/src/joins/hash_join.rs +++ b/datafusion/physical-plan/src/joins/hash_join.rs @@ -1560,7 +1560,7 @@ mod tests { use rstest_reuse::*; fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b + a.div_ceil(b) } #[template] diff --git a/datafusion/physical-plan/src/metrics/value.rs b/datafusion/physical-plan/src/metrics/value.rs index 2eb01914ee0a..decf77369db4 100644 --- a/datafusion/physical-plan/src/metrics/value.rs +++ b/datafusion/physical-plan/src/metrics/value.rs @@ -313,7 +313,7 @@ pub struct ScopedTimerGuard<'a> { start: Option, } -impl<'a> ScopedTimerGuard<'a> { +impl ScopedTimerGuard<'_> { /// Stop the timer timing and record the time taken pub fn stop(&mut self) { if let Some(start) = self.start.take() { @@ -332,7 +332,7 @@ impl<'a> ScopedTimerGuard<'a> { } } -impl<'a> Drop for ScopedTimerGuard<'a> { +impl Drop for ScopedTimerGuard<'_> { fn drop(&mut self) { self.stop() } diff --git a/datafusion/physical-plan/src/repartition/distributor_channels.rs b/datafusion/physical-plan/src/repartition/distributor_channels.rs index 2e5ef24beac3..8d09c664fbb2 100644 --- a/datafusion/physical-plan/src/repartition/distributor_channels.rs +++ b/datafusion/physical-plan/src/repartition/distributor_channels.rs @@ -203,7 +203,7 @@ pub struct SendFuture<'a, T> { element: Box>, } -impl<'a, T> Future for SendFuture<'a, T> { +impl Future for SendFuture<'_, T> { type Output = Result<(), SendError>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -295,7 +295,7 @@ pub struct RecvFuture<'a, T> { rdy: bool, } -impl<'a, T> Future for RecvFuture<'a, T> { +impl Future for RecvFuture<'_, T> { type Output = Option; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs index 9a89db9a5893..906164f21b8c 100644 --- a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs +++ b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs @@ -746,7 +746,7 @@ mod tests { // Split the provided record batch into multiple batch_size record batches fn split_batch(sorted: &RecordBatch, batch_size: usize) -> Vec { - let batches = (sorted.num_rows() + batch_size - 1) / batch_size; + let batches = sorted.num_rows().div_ceil(batch_size); // Split the sorted RecordBatch into multiple (0..batches) diff --git a/datafusion/physical-plan/src/sorts/streaming_merge.rs b/datafusion/physical-plan/src/sorts/streaming_merge.rs index 4350235ef47d..2178cc012a10 100644 --- a/datafusion/physical-plan/src/sorts/streaming_merge.rs +++ b/datafusion/physical-plan/src/sorts/streaming_merge.rs @@ -62,7 +62,7 @@ pub struct StreamingMergeBuilder<'a> { enable_round_robin_tie_breaker: bool, } -impl<'a> Default for StreamingMergeBuilder<'a> { +impl Default for StreamingMergeBuilder<'_> { fn default() -> Self { Self { streams: vec![], diff --git a/datafusion/physical-plan/src/stream.rs b/datafusion/physical-plan/src/stream.rs index ec4c9dd502a6..b3054299b7f7 100644 --- a/datafusion/physical-plan/src/stream.rs +++ b/datafusion/physical-plan/src/stream.rs @@ -48,7 +48,6 @@ use tokio::task::JoinSet; /// 3. Automatically cancels any outstanding tasks when the receiver stream is dropped. /// /// [`ReceiverStream` from tokio-stream]: https://docs.rs/tokio-stream/latest/tokio_stream/wrappers/struct.ReceiverStream.html - pub(crate) struct ReceiverStreamBuilder { tx: Sender>, rx: Receiver>, diff --git a/datafusion/physical-plan/src/test/exec.rs b/datafusion/physical-plan/src/test/exec.rs index cf1c0e313733..cc0a7cbd9b52 100644 --- a/datafusion/physical-plan/src/test/exec.rs +++ b/datafusion/physical-plan/src/test/exec.rs @@ -714,8 +714,6 @@ pub async fn assert_strong_count_converges_to_zero(refs: Weak) { .unwrap(); } -/// - /// Execution plan that emits streams that panics. /// /// This is useful to test panic handling of certain execution plans. diff --git a/datafusion/sql/src/cte.rs b/datafusion/sql/src/cte.rs index c288d6ca7067..3650aea9c3c2 100644 --- a/datafusion/sql/src/cte.rs +++ b/datafusion/sql/src/cte.rs @@ -28,7 +28,7 @@ use datafusion_common::{ use datafusion_expr::{LogicalPlan, LogicalPlanBuilder, TableSource}; use sqlparser::ast::{Query, SetExpr, SetOperator, With}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn plan_with_clause( &self, with: With, diff --git a/datafusion/sql/src/expr/binary_op.rs b/datafusion/sql/src/expr/binary_op.rs index fcb57e8a82e4..eaf28adf4ea8 100644 --- a/datafusion/sql/src/expr/binary_op.rs +++ b/datafusion/sql/src/expr/binary_op.rs @@ -20,7 +20,7 @@ use datafusion_common::{not_impl_err, Result}; use datafusion_expr::Operator; use sqlparser::ast::BinaryOperator; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_sql_binary_op(&self, op: BinaryOperator) -> Result { match op { BinaryOperator::Gt => Ok(Operator::Gt), diff --git a/datafusion/sql/src/expr/function.rs b/datafusion/sql/src/expr/function.rs index cb7255bb7873..67fa23b86990 100644 --- a/datafusion/sql/src/expr/function.rs +++ b/datafusion/sql/src/expr/function.rs @@ -190,7 +190,7 @@ impl FunctionArgs { } } -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_function_to_expr( &self, function: SQLFunction, diff --git a/datafusion/sql/src/expr/grouping_set.rs b/datafusion/sql/src/expr/grouping_set.rs index a8b3ef7e20ec..bedbf2a7d347 100644 --- a/datafusion/sql/src/expr/grouping_set.rs +++ b/datafusion/sql/src/expr/grouping_set.rs @@ -21,7 +21,7 @@ use datafusion_common::{DFSchema, Result}; use datafusion_expr::{Expr, GroupingSet}; use sqlparser::ast::Expr as SQLExpr; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_grouping_sets_to_expr( &self, exprs: Vec>, diff --git a/datafusion/sql/src/expr/identifier.rs b/datafusion/sql/src/expr/identifier.rs index e103f68fc927..9adf14459081 100644 --- a/datafusion/sql/src/expr/identifier.rs +++ b/datafusion/sql/src/expr/identifier.rs @@ -28,7 +28,7 @@ use datafusion_expr::{Case, Expr}; use crate::planner::{ContextProvider, PlannerContext, SqlToRel}; use datafusion_expr::UNNAMED_TABLE; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_identifier_to_expr( &self, id: Ident, diff --git a/datafusion/sql/src/expr/mod.rs b/datafusion/sql/src/expr/mod.rs index a095d895b46f..57ac96951f1f 100644 --- a/datafusion/sql/src/expr/mod.rs +++ b/datafusion/sql/src/expr/mod.rs @@ -49,7 +49,7 @@ mod substring; mod unary_op; mod value; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn sql_expr_to_logical_expr( &self, sql: SQLExpr, diff --git a/datafusion/sql/src/expr/order_by.rs b/datafusion/sql/src/expr/order_by.rs index 00289806876f..b7ed04326f40 100644 --- a/datafusion/sql/src/expr/order_by.rs +++ b/datafusion/sql/src/expr/order_by.rs @@ -23,7 +23,7 @@ use datafusion_expr::expr::Sort; use datafusion_expr::{Expr, SortExpr}; use sqlparser::ast::{Expr as SQLExpr, OrderByExpr, Value}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Convert sql [OrderByExpr] to `Vec`. /// /// `input_schema` and `additional_schema` are used to resolve column references in the order-by expressions. diff --git a/datafusion/sql/src/expr/subquery.rs b/datafusion/sql/src/expr/subquery.rs index ff161c6ed644..481f024787fe 100644 --- a/datafusion/sql/src/expr/subquery.rs +++ b/datafusion/sql/src/expr/subquery.rs @@ -24,7 +24,7 @@ use sqlparser::ast::Expr as SQLExpr; use sqlparser::ast::Query; use std::sync::Arc; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn parse_exists_subquery( &self, subquery: Query, diff --git a/datafusion/sql/src/expr/substring.rs b/datafusion/sql/src/expr/substring.rs index f58ab5ff3612..59c78bc713cc 100644 --- a/datafusion/sql/src/expr/substring.rs +++ b/datafusion/sql/src/expr/substring.rs @@ -22,7 +22,7 @@ use datafusion_expr::planner::PlannerResult; use datafusion_expr::Expr; use sqlparser::ast::Expr as SQLExpr; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_substring_to_expr( &self, expr: Box, diff --git a/datafusion/sql/src/expr/unary_op.rs b/datafusion/sql/src/expr/unary_op.rs index 06988eb03893..a4096ec2355b 100644 --- a/datafusion/sql/src/expr/unary_op.rs +++ b/datafusion/sql/src/expr/unary_op.rs @@ -23,7 +23,7 @@ use datafusion_expr::{ }; use sqlparser::ast::{Expr as SQLExpr, UnaryOperator, Value}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_sql_unary_op( &self, op: UnaryOperator, diff --git a/datafusion/sql/src/expr/value.rs b/datafusion/sql/src/expr/value.rs index 1cf090aa64aa..a651567abe22 100644 --- a/datafusion/sql/src/expr/value.rs +++ b/datafusion/sql/src/expr/value.rs @@ -32,7 +32,7 @@ use sqlparser::ast::{BinaryOperator, Expr as SQLExpr, Interval, UnaryOperator, V use sqlparser::parser::ParserError::ParserError; use std::borrow::Cow; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_value( &self, value: Value, diff --git a/datafusion/sql/src/query.rs b/datafusion/sql/src/query.rs index 740f9ad3b42c..2e115d140ea8 100644 --- a/datafusion/sql/src/query.rs +++ b/datafusion/sql/src/query.rs @@ -29,7 +29,7 @@ use sqlparser::ast::{ SetExpr, }; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logical plan from an SQL query/subquery pub(crate) fn query_to_plan( &self, diff --git a/datafusion/sql/src/relation/join.rs b/datafusion/sql/src/relation/join.rs index 3f34608e3756..2ed1197e8fbf 100644 --- a/datafusion/sql/src/relation/join.rs +++ b/datafusion/sql/src/relation/join.rs @@ -21,7 +21,7 @@ use datafusion_expr::{JoinType, LogicalPlan, LogicalPlanBuilder}; use sqlparser::ast::{Join, JoinConstraint, JoinOperator, TableFactor, TableWithJoins}; use std::collections::HashSet; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn plan_table_with_joins( &self, t: TableWithJoins, diff --git a/datafusion/sql/src/relation/mod.rs b/datafusion/sql/src/relation/mod.rs index 256cc58e71dc..45a617daae96 100644 --- a/datafusion/sql/src/relation/mod.rs +++ b/datafusion/sql/src/relation/mod.rs @@ -28,7 +28,7 @@ use sqlparser::ast::{FunctionArg, FunctionArgExpr, TableFactor}; mod join; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Create a `LogicalPlan` that scans the named relation fn create_relation( &self, diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rs index 12fc013a2ab8..39b6eb6e8132 100644 --- a/datafusion/sql/src/select.rs +++ b/datafusion/sql/src/select.rs @@ -45,7 +45,7 @@ use sqlparser::ast::{ }; use sqlparser::ast::{NamedWindowDefinition, Select, SelectItem, TableWithJoins}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logic plan from an SQL select pub(super) fn select_to_plan( &self, diff --git a/datafusion/sql/src/set_expr.rs b/datafusion/sql/src/set_expr.rs index e56ebb4d323f..3b1201d3dd59 100644 --- a/datafusion/sql/src/set_expr.rs +++ b/datafusion/sql/src/set_expr.rs @@ -21,7 +21,7 @@ use datafusion_expr::{LogicalPlan, LogicalPlanBuilder}; use recursive::recursive; use sqlparser::ast::{SetExpr, SetOperator, SetQuantifier}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { #[recursive] pub(super) fn set_expr_to_plan( &self, diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs index 31b836f32b24..38695f98b5fe 100644 --- a/datafusion/sql/src/statement.rs +++ b/datafusion/sql/src/statement.rs @@ -163,7 +163,7 @@ fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> Vec SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logical plan from an DataFusion SQL statement pub fn statement_to_plan(&self, statement: DFStatement) -> Result { match statement { diff --git a/datafusion/sql/src/unparser/mod.rs b/datafusion/sql/src/unparser/mod.rs index 83ae64ba238b..2c2530ade7fb 100644 --- a/datafusion/sql/src/unparser/mod.rs +++ b/datafusion/sql/src/unparser/mod.rs @@ -107,7 +107,7 @@ impl<'a> Unparser<'a> { } } -impl<'a> Default for Unparser<'a> { +impl Default for Unparser<'_> { fn default() -> Self { Self { dialect: &DefaultDialect {}, diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rs index e479bdbacd83..e29a2299b41c 100644 --- a/datafusion/sql/src/utils.rs +++ b/datafusion/sql/src/utils.rs @@ -328,7 +328,7 @@ struct RecursiveUnnestRewriter<'a> { columns_unnestings: &'a mut IndexMap>>, transformed_root_exprs: Option>, } -impl<'a> RecursiveUnnestRewriter<'a> { +impl RecursiveUnnestRewriter<'_> { /// This struct stores the history of expr /// during its tree-traversal with a notation of /// \[None,**Unnest(exprA)**,**Unnest(exprB)**,None,None\] @@ -416,7 +416,7 @@ impl<'a> RecursiveUnnestRewriter<'a> { } } -impl<'a> TreeNodeRewriter for RecursiveUnnestRewriter<'a> { +impl TreeNodeRewriter for RecursiveUnnestRewriter<'_> { type Node = Expr; /// This downward traversal needs to keep track of: diff --git a/datafusion/sql/src/values.rs b/datafusion/sql/src/values.rs index a4001bea7dea..dd8957c95470 100644 --- a/datafusion/sql/src/values.rs +++ b/datafusion/sql/src/values.rs @@ -22,7 +22,7 @@ use datafusion_common::{DFSchema, Result}; use datafusion_expr::{LogicalPlan, LogicalPlanBuilder}; use sqlparser::ast::Values as SQLValues; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_values_to_plan( &self, values: SQLValues, diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index ce7d1744f2f5..000000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -[toolchain] -# Temporarily pin toolchain version until problems reported by newer clippy release are solved. -channel = "1.82.0"