Apache DataFusion SQL Query Engine
deny on allow_attributes lint in physical-plan (#18983)
YuraLitvinov5519b6145717
diff --git a/datafusion/physical-expr/src/aggregate.rs b/datafusion/physical-expr/src/aggregate.rsindex f16895b44b..dfd2e93030 100644--- a/datafusion/physical-expr/src/aggregate.rs+++ b/datafusion/physical-expr/src/aggregate.rs@@ -16,7 +16,7 @@// under the License.pub(crate) mod groups_accumulator {- #[allow(unused_imports)]+ #[expect(unused_imports)]pub(crate) mod accumulate {pub use datafusion_functions_aggregate_common::aggregate::groups_accumulator::accumulate::NullState;}diff --git a/datafusion/physical-expr/src/intervals/cp_solver.rs b/datafusion/physical-expr/src/intervals/cp_solver.rsindex b1fe75a223..cb2391fd1d 100644--- a/datafusion/physical-expr/src/intervals/cp_solver.rs+++ b/datafusion/physical-expr/src/intervals/cp_solver.rs@@ -780,7 +780,7 @@ mod tests {use rand::{Rng, SeedableRng};use rstest::*;- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]fn experiment(expr: Arc<dyn PhysicalExpr>,exprs_with_interval: (Arc<dyn PhysicalExpr>, Arc<dyn PhysicalExpr>),diff --git a/datafusion/physical-expr/src/intervals/test_utils.rs b/datafusion/physical-expr/src/intervals/test_utils.rsindex c3d38a974a..9a59227970 100644--- a/datafusion/physical-expr/src/intervals/test_utils.rs+++ b/datafusion/physical-expr/src/intervals/test_utils.rs@@ -25,7 +25,7 @@ use arrow::datatypes::Schema;use datafusion_common::{DataFusionError, ScalarValue};use datafusion_expr::Operator;-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]/// This test function generates a conjunctive statement with two numeric/// terms with the following form:/// left_col (op_1) a >/>= right_col (op_2) b AND left_col (op_3) c </<= right_col (op_4) d@@ -61,7 +61,7 @@ pub fn gen_conjunctive_numerical_expr(Arc::new(BinaryExpr::new(left_expr, Operator::And, right_expr))}-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]/// This test function generates a conjunctive statement with/// two scalar values with the following form:/// left_col (op_1) a > right_col (op_2) b AND left_col (op_3) c < right_col (op_4) ddiff --git a/datafusion/physical-expr/src/lib.rs b/datafusion/physical-expr/src/lib.rsindex 7feda2360c..871cebe602 100644--- a/datafusion/physical-expr/src/lib.rs+++ b/datafusion/physical-expr/src/lib.rs@@ -24,6 +24,8 @@// https://github.com/apache/datafusion/issues/11143#![deny(clippy::clone_on_ref_ptr)]#![cfg_attr(test, allow(clippy::needless_pass_by_value))]+// https://github.com/apache/datafusion/issues/18881+#![deny(clippy::allow_attributes)]// Backward compatibilitypub mod aggregate;diff --git a/datafusion/physical-expr/src/window/standard_window_function_expr.rs b/datafusion/physical-expr/src/window/standard_window_function_expr.rsindex 9b1213450c..a6ea5e44a4 100644--- a/datafusion/physical-expr/src/window/standard_window_function_expr.rs+++ b/datafusion/physical-expr/src/window/standard_window_function_expr.rs@@ -28,14 +28,13 @@ use std::any::Any;use std::sync::Arc;/// Evaluates a window function by instantiating a-/// `[PartitionEvaluator]` for calculating the function's output in+/// [`PartitionEvaluator`] for calculating the function's output in/// that partition.////// Note that unlike aggregation based window functions, some window/// functions such as `rank` ignore the values in the window frame,/// but others such as `first_value`, `last_value`, and/// `nth_value` need the value.-#[allow(rustdoc::private_intra_doc_links)]pub trait StandardWindowFunctionExpr: Send + Sync + std::fmt::Debug {/// Returns the aggregate expression as [`Any`] so that it can be/// downcast to a specific implementation.diff --git a/datafusion/physical-expr/src/window/window_expr.rs b/datafusion/physical-expr/src/window/window_expr.rsindex ace0c31d63..8f6f61a2da 100644--- a/datafusion/physical-expr/src/window/window_expr.rs+++ b/datafusion/physical-expr/src/window/window_expr.rs@@ -281,7 +281,7 @@ pub trait AggregateWindowExpr: WindowExpr {/// * `window_frame_ctx`: Details about the window frame (see [`WindowFrameContext`])./// * `idx`: The index of the current row in the record batch./// * `not_end`: is the current row not the end of the partition (see [`PartitionBatchState`]).- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]fn get_result_column(&self,accumulator: &mut Box<dyn Accumulator>,diff --git a/datafusion/physical-plan/src/aggregates/mod.rs b/datafusion/physical-plan/src/aggregates/mod.rsindex a87abc2aa5..f2dd785794 100644--- a/datafusion/physical-plan/src/aggregates/mod.rs+++ b/datafusion/physical-plan/src/aggregates/mod.rs@@ -377,7 +377,7 @@ impl PartialEq for PhysicalGroupBy {}}-#[allow(clippy::large_enum_variant)]+#[expect(clippy::large_enum_variant)]enum StreamType {AggregateStream(AggregateStream),GroupedHash(GroupedHashAggregateStream),@@ -575,7 +575,6 @@ impl AggregateExec {/// a rule may re-write aggregate expressions (e.g. reverse them) during/// initialization, field names may change inadvertently if one re-creates/// the schema in such cases.- #[allow(clippy::too_many_arguments)]fn try_new_with_schema(mode: AggregateMode,group_by: PhysicalGroupBy,diff --git a/datafusion/physical-plan/src/execution_plan.rs b/datafusion/physical-plan/src/execution_plan.rsindex c37a8ade07..d3043ee93c 100644--- a/datafusion/physical-plan/src/execution_plan.rs+++ b/datafusion/physical-plan/src/execution_plan.rs@@ -1534,7 +1534,7 @@ mod tests {/// A compilation test to ensure that the `ExecutionPlan::name()` method can/// be called from a trait object./// Related ticket: https://github.com/apache/datafusion/pull/11047- #[allow(dead_code)]+ #[expect(unused)]fn use_execution_plan_as_trait_object(plan: &dyn ExecutionPlan) {let _ = plan.name();}diff --git a/datafusion/physical-plan/src/joins/cross_join.rs b/datafusion/physical-plan/src/joins/cross_join.rsindex 0488cd35a8..b90243fdb6 100644--- a/datafusion/physical-plan/src/joins/cross_join.rs+++ b/datafusion/physical-plan/src/joins/cross_join.rs@@ -61,7 +61,7 @@ struct JoinLeftData {_reservation: MemoryReservation,}-#[allow(rustdoc::private_intra_doc_links)]+#[expect(rustdoc::private_intra_doc_links)]/// Cross Join Execution Plan////// This operator is used when there are no predicates between two tables anddiff --git a/datafusion/physical-plan/src/joins/hash_join/exec.rs b/datafusion/physical-plan/src/joins/hash_join/exec.rsindex 97ee8ecbdb..2936c64abf 100644--- a/datafusion/physical-plan/src/joins/hash_join/exec.rs+++ b/datafusion/physical-plan/src/joins/hash_join/exec.rs@@ -142,7 +142,7 @@ impl JoinLeftData {}}-#[allow(rustdoc::private_intra_doc_links)]+#[expect(rustdoc::private_intra_doc_links)]/// Join execution plan: Evaluates equijoin predicates in parallel on multiple/// partitions using a hash table and an optional filter list to apply post/// join.@@ -387,7 +387,7 @@ impl HashJoinExec {////// # Error/// This function errors when it is not possible to join the left and right sides on keys `on`.- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub fn try_new(left: Arc<dyn ExecutionPlan>,right: Arc<dyn ExecutionPlan>,@@ -1336,7 +1336,7 @@ impl BuildSideState {/// # Returns/// `JoinLeftData` containing the hash map, consolidated batch, join key values,/// visited indices bitmap, and computed bounds (if requested).-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]async fn collect_left_input(random_state: RandomState,left_stream: SendableRecordBatchStream,diff --git a/datafusion/physical-plan/src/joins/hash_join/stream.rs b/datafusion/physical-plan/src/joins/hash_join/stream.rsindex a50a6551db..ed7da409ce 100644--- a/datafusion/physical-plan/src/joins/hash_join/stream.rs+++ b/datafusion/physical-plan/src/joins/hash_join/stream.rs@@ -272,7 +272,6 @@ impl RecordBatchStream for HashJoinStream {/// Build indices: 4, 5, 6, 6/// Probe indices: 3, 3, 4, 5/// ```-#[allow(clippy::too_many_arguments)]pub(super) fn lookup_join_hashmap(build_hashmap: &dyn JoinHashMapType,build_side_values: &[ArrayRef],@@ -329,7 +328,7 @@ fn count_distinct_sorted_indices(indices: &UInt32Array) -> usize {}impl HashJoinStream {- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub(super) fn new(partition: usize,schema: Arc<Schema>,diff --git a/datafusion/physical-plan/src/joins/nested_loop_join.rs b/datafusion/physical-plan/src/joins/nested_loop_join.rsindex c82961e0e7..e61e457247 100644--- a/datafusion/physical-plan/src/joins/nested_loop_join.rs+++ b/datafusion/physical-plan/src/joins/nested_loop_join.rs@@ -75,7 +75,7 @@ use futures::{Stream, StreamExt, TryStreamExt};use log::debug;use parking_lot::Mutex;-#[allow(rustdoc::private_intra_doc_links)]+#[expect(rustdoc::private_intra_doc_links)]/// NestedLoopJoinExec is a build-probe join operator designed for joins that/// do not have equijoin keys in their `ON` clause.///@@ -785,7 +785,7 @@ pub(crate) struct NestedLoopJoinStream {left_exhausted: bool,/// If we can buffer all left data in one pass/// TODO(now): this is for the (unimplemented) memory-limited execution- #[allow(dead_code)]+ #[expect(dead_code)]left_buffered_in_one_pass: bool,// Probe(right) side@@ -1013,7 +1013,7 @@ impl RecordBatchStream for NestedLoopJoinStream {}impl NestedLoopJoinStream {- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub(crate) fn new(schema: Arc<Schema>,filter: Option<JoinFilter>,diff --git a/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs b/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rsindex 695e73f109..c74f4d984e 100644--- a/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs+++ b/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs@@ -70,7 +70,6 @@ pub(super) struct SortedStreamBatch {}impl SortedStreamBatch {- #[allow(dead_code)]fn new(batch: RecordBatch, compare_key_values: Vec<ArrayRef>) -> Self {Self {batch,@@ -132,7 +131,7 @@ impl RecordBatchStream for ClassicPWMJStream {// `Completed` however for Full and Right we will need to process the unmatched buffered rows.impl ClassicPWMJStream {// Creates a new `PiecewiseMergeJoinStream` instance- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub fn try_new(schema: Arc<Schema>,on_streamed: PhysicalExprRef,@@ -248,10 +247,7 @@ impl ClassicPWMJStream {// Reset BatchProcessState before processing a new stream batchself.batch_process_state.reset();self.state = PiecewiseMergeJoinStreamState::ProcessStreamBatch(- SortedStreamBatch {- batch: stream_batch,- compare_key_values: vec![stream_values],- },+ SortedStreamBatch::new(stream_batch, vec![stream_values]),);}Some(Err(err)) => return Poll::Ready(Err(err)),@@ -451,7 +447,6 @@ impl Stream for ClassicPWMJStream {}// For Left, Right, Full, and Inner joins, incoming stream batches will already be sorted.-#[allow(clippy::too_many_arguments)]fn resolve_classic_join(buffered_side: &mut BufferedSideReadyState,stream_batch: &SortedStreamBatch,diff --git a/datafusion/physical-plan/src/joins/piecewise_merge_join/exec.rs b/datafusion/physical-plan/src/joins/piecewise_merge_join/exec.rsindex a9ea92f2d9..06a1df4386 100644--- a/datafusion/physical-plan/src/joins/piecewise_merge_join/exec.rs+++ b/datafusion/physical-plan/src/joins/piecewise_merge_join/exec.rs@@ -272,7 +272,7 @@ pub struct PiecewiseMergeJoinExec {left_child_plan_required_order: LexOrdering,/// The right sort order, descending for `<`, `<=` operations + ascending for `>`, `>=` operations/// Unsorted for mark joins- #[allow(unused)]+ #[expect(dead_code)]right_batch_required_orders: LexOrdering,/// This determines the sort order of all join columns used in sorting the stream and buffered execution plans.diff --git a/datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs b/datafusion/physical-plan/src/joins/sort_merge_join/metrics.rsindex ac476853d5..8457408919 100644--- a/datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs+++ b/datafusion/physical-plan/src/joins/sort_merge_join/metrics.rs@@ -23,7 +23,6 @@ use crate::metrics::{};/// Metrics for SortMergeJoinExec-#[allow(dead_code)]pub(super) struct SortMergeJoinMetrics {/// Total time for joining probe-side batches to the build-side batchesjoin_time: Time,@@ -41,7 +40,6 @@ pub(super) struct SortMergeJoinMetrics {}impl SortMergeJoinMetrics {- #[allow(dead_code)]pub fn new(partition: usize, metrics: &ExecutionPlanMetricsSet) -> Self {let join_time = MetricBuilder::new(metrics).subset_time("join_time", partition);let input_batches =diff --git a/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs b/datafusion/physical-plan/src/joins/sort_merge_join/stream.rsindex 9acaba1c89..e1d002a436 100644--- a/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs+++ b/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs@@ -533,7 +533,7 @@ pub(super) fn get_corrected_filter_mask(// If the left row seen as true its needed to output it once// To do that we mark all other matches for same row as null to avoid the outputif seen_true {- #[allow(clippy::needless_range_loop)]+ #[expect(clippy::needless_range_loop)]for j in first_row_idx..last_true_idx {mask[j] = None;}@@ -748,7 +748,7 @@ impl Stream for SortMergeJoinStream {}impl SortMergeJoinStream {- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub fn try_new(// Configured via `datafusion.execution.spill_compression`.spill_compression: SpillCompression,diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rsindex 9c778ad131..2b8d2bd40e 100644--- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs+++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs@@ -207,7 +207,7 @@ impl SymmetricHashJoinExec {/// - It is not possible to join the left and right sides on keys `on`, or/// - It fails to construct `SortedFilterExpr`s, or/// - It fails to create the [ExprIntervalGraph].- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub fn try_new(left: Arc<dyn ExecutionPlan>,right: Arc<dyn ExecutionPlan>,@@ -957,7 +957,7 @@ pub(crate) fn build_side_determined_results(////// A [Result] containing an optional record batch if the join type is not one of `LeftAnti`, `RightAnti`, `LeftSemi` or `RightSemi`./// If the join type is one of the above four, the function will return [None].-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]pub(crate) fn join_with_probe_batch(build_hash_joiner: &mut OneSideHashJoiner,probe_hash_joiner: &mut OneSideHashJoiner,@@ -1055,7 +1055,7 @@ pub(crate) fn join_with_probe_batch(////// A [Result] containing a tuple with two equal length arrays, representing indices of rows from build and probe side,/// matched by join key columns.-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]fn lookup_join_hashmap(build_hashmap: &PruningJoinHashMap,build_batch: &RecordBatch,diff --git a/datafusion/physical-plan/src/joins/utils.rs b/datafusion/physical-plan/src/joins/utils.rsindex 9087ac415f..561c9c022f 100644--- a/datafusion/physical-plan/src/joins/utils.rs+++ b/datafusion/physical-plan/src/joins/utils.rs@@ -1683,7 +1683,7 @@ pub fn swap_join_projection(/// `fifo_hashmap` sets the order of iteration over `batch` rows while updating hashmap,/// which allows to keep either first (if set to true) or last (if set to false) row index/// as a chain head for rows with equal hash values.-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]pub fn update_hash(on: &[PhysicalExprRef],batch: &RecordBatch,diff --git a/datafusion/physical-plan/src/lib.rs b/datafusion/physical-plan/src/lib.rsindex 45425aa717..107ace95bb 100644--- a/datafusion/physical-plan/src/lib.rs+++ b/datafusion/physical-plan/src/lib.rs@@ -24,6 +24,8 @@// https://github.com/apache/datafusion/issues/11143#![deny(clippy::clone_on_ref_ptr)]#![cfg_attr(test, allow(clippy::needless_pass_by_value))]+// https://github.com/apache/datafusion/issues/18881+#![deny(clippy::allow_attributes)]//! Traits for physical query plan, supporting parallel execution for partitioned relations.//!diff --git a/datafusion/physical-plan/src/projection.rs b/datafusion/physical-plan/src/projection.rsindex 8e8baef3e7..c256bcbcd6 100644--- a/datafusion/physical-plan/src/projection.rs+++ b/datafusion/physical-plan/src/projection.rs@@ -785,10 +785,6 @@ pub fn update_join_on(hash_join_on: &[(PhysicalExprRef, PhysicalExprRef)],left_field_size: usize,) -> Option<Vec<(PhysicalExprRef, PhysicalExprRef)>> {- // TODO: Clippy wants the "map" call removed, but doing so generates- // a compilation error. Remove the clippy directive once this- // issue is fixed.- #[allow(clippy::map_identity)]let (left_idx, right_idx): (Vec<_>, Vec<_>) = hash_join_on.iter().map(|(left, right)| (left, right))diff --git a/datafusion/physical-plan/src/render_tree.rs b/datafusion/physical-plan/src/render_tree.rsindex f86e4c55e7..40e2763698 100644--- a/datafusion/physical-plan/src/render_tree.rs+++ b/datafusion/physical-plan/src/render_tree.rs@@ -31,11 +31,12 @@ use crate::{DisplayFormatType, ExecutionPlan};// TODO: It's never used./// Represents a 2D coordinate in the rendered tree./// Used to track positions of nodes and their connections.-#[allow(dead_code)]pub struct Coordinate {/// Horizontal position in the tree+ #[expect(dead_code)]pub x: usize,/// Vertical position in the tree+ #[expect(dead_code)]pub y: usize,}diff --git a/datafusion/physical-plan/src/sorts/multi_level_merge.rs b/datafusion/physical-plan/src/sorts/multi_level_merge.rsindex 6e7a5e7a72..784c9f7a60 100644--- a/datafusion/physical-plan/src/sorts/multi_level_merge.rs+++ b/datafusion/physical-plan/src/sorts/multi_level_merge.rs@@ -145,7 +145,7 @@ impl Debug for MultiLevelMergeBuilder {}impl MultiLevelMergeBuilder {- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub(crate) fn new(spill_manager: SpillManager,schema: SchemaRef,diff --git a/datafusion/physical-plan/src/sorts/sort.rs b/datafusion/physical-plan/src/sorts/sort.rsindex c4c871da74..00cc96dccf 100644--- a/datafusion/physical-plan/src/sorts/sort.rs+++ b/datafusion/physical-plan/src/sorts/sort.rs@@ -266,7 +266,7 @@ struct ExternalSorter {impl ExternalSorter {// TODO: make a builder or some other nicer API to avoid the// clippy warning- #[allow(clippy::too_many_arguments)]+ #[expect(clippy::too_many_arguments)]pub fn new(partition_id: usize,schema: SchemaRef,diff --git a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rsindex ccc154bc10..eb8bb982b8 100644--- a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs+++ b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs@@ -1474,20 +1474,6 @@ mod tests {Ok(results)}- /// Execute the [ExecutionPlan] and collect the results in memory- #[allow(dead_code)]- pub async fn collect_bonafide(- plan: Arc<dyn ExecutionPlan>,- context: Arc<TaskContext>,- ) -> Result<Vec<RecordBatch>> {- let stream = execute_stream(plan, context)?;- let mut results = vec![];-- collect_stream(stream, &mut results).await?;-- Ok(results)- }-fn test_schema() -> SchemaRef {Arc::new(Schema::new(vec![Field::new("sn", DataType::UInt64, true),diff --git a/datafusion/physical-plan/src/windows/mod.rs b/datafusion/physical-plan/src/windows/mod.rsindex cd35325eb3..01926ab156 100644--- a/datafusion/physical-plan/src/windows/mod.rs+++ b/datafusion/physical-plan/src/windows/mod.rs@@ -88,7 +88,7 @@ pub fn schema_add_window_field(}/// Create a physical expression for window function-#[allow(clippy::too_many_arguments)]+#[expect(clippy::too_many_arguments)]pub fn create_window_expr(fun: &WindowFunctionDefinition,name: String,diff --git a/datafusion/physical-plan/src/work_table.rs b/datafusion/physical-plan/src/work_table.rsindex e2c6efd508..b0f300dd37 100644--- a/datafusion/physical-plan/src/work_table.rs+++ b/datafusion/physical-plan/src/work_table.rs@@ -40,7 +40,6 @@ use datafusion_physical_expr::{EquivalenceProperties, Partitioning};#[derive(Debug)]pub(super) struct ReservedBatches {batches: Vec<RecordBatch>,- #[allow(dead_code)]reservation: MemoryReservation,}