Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions datafusion/expr/src/execution_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl ExecutionProps {
}

/// Returns the provider for the `var_type`, if any
#[allow(clippy::needless_pass_by_value)]
pub fn get_var_provider(
&self,
var_type: VarType,
Expand Down
6 changes: 3 additions & 3 deletions datafusion/expr/src/expr_rewriter/order_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn rewrite_sort_col_by_aggs(expr: Expr, plan: &LogicalPlan) -> Result<Expr> {
// on top of them)
if plan_inputs.len() == 1 {
let proj_exprs = plan.expressions();
rewrite_in_terms_of_projection(expr, proj_exprs, plan_inputs[0])
rewrite_in_terms_of_projection(expr, &proj_exprs, plan_inputs[0])
} else {
Ok(expr)
}
Expand All @@ -71,7 +71,7 @@ fn rewrite_sort_col_by_aggs(expr: Expr, plan: &LogicalPlan) -> Result<Expr> {
/// 2. t produces an output schema with two columns "a", "b + c"
fn rewrite_in_terms_of_projection(
expr: Expr,
proj_exprs: Vec<Expr>,
proj_exprs: &[Expr],
input: &LogicalPlan,
) -> Result<Expr> {
// assumption is that each item in exprs, such as "b + c" is
Expand Down Expand Up @@ -104,7 +104,7 @@ fn rewrite_in_terms_of_projection(

// look for the column named the same as this expr
let mut found = None;
for proj_expr in &proj_exprs {
for proj_expr in proj_exprs {
proj_expr.apply(|e| {
if expr_match(&search_col, e) {
found = Some(e.clone());
Expand Down
6 changes: 6 additions & 0 deletions datafusion/expr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]

// https://github.com/apache/datafusion/issues/18503
#![deny(clippy::needless_pass_by_value)]
// This lint rule is enforced in `../Cargo.toml`, but it's okay to skip them in tests
// See details in https://github.com/apache/datafusion/issues/18503
Comment thread
Gohlub marked this conversation as resolved.
Outdated
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]

//! [DataFusion](https://github.com/apache/datafusion)
//! is an extensible query execution framework that uses
//! [Apache Arrow](https://arrow.apache.org) as its in-memory format.
Expand Down
3 changes: 3 additions & 0 deletions datafusion/expr/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ use crate::Expr;
use datafusion_common::{metadata::FieldMetadata, ScalarValue};

/// Create a literal expression
#[allow(clippy::needless_pass_by_value)]
pub fn lit<T: Literal>(n: T) -> Expr {
n.lit()
}

#[allow(clippy::needless_pass_by_value)]
pub fn lit_with_metadata<T: Literal>(n: T, metadata: Option<FieldMetadata>) -> Expr {
let Some(metadata) = metadata else {
return n.lit();
Expand All @@ -45,6 +47,7 @@ pub fn lit_with_metadata<T: Literal>(n: T, metadata: Option<FieldMetadata>) -> E
}

/// Create a literal timestamp expression
#[allow(clippy::needless_pass_by_value)]
pub fn lit_timestamp_nano<T: TimestampLiteral>(n: T) -> Expr {
n.lit_timestamp_nano()
}
Expand Down
1 change: 1 addition & 0 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3481,6 +3481,7 @@ impl Aggregate {
///
/// This method should only be called when you are absolutely sure that the schema being
/// provided is correct for the aggregate. If in doubt, call [try_new](Self::try_new) instead.
#[allow(clippy::needless_pass_by_value)]
pub fn try_new_with_schema(
input: Arc<LogicalPlan>,
group_expr: Vec<Expr>,
Expand Down
7 changes: 4 additions & 3 deletions datafusion/expr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ fn get_excluded_columns(
/// Returns all `Expr`s in the schema, except the `Column`s in the `columns_to_skip`
fn get_exprs_except_skipped(
schema: &DFSchema,
columns_to_skip: HashSet<Column>,
columns_to_skip: &HashSet<Column>,
) -> Vec<Expr> {
if columns_to_skip.is_empty() {
schema.iter().map(Expr::from).collect::<Vec<Expr>>()
Expand Down Expand Up @@ -419,7 +419,7 @@ pub fn expand_wildcard(
};
// Add each excluded `Column` to columns_to_skip
columns_to_skip.extend(excluded_columns);
Ok(get_exprs_except_skipped(schema, columns_to_skip))
Ok(get_exprs_except_skipped(schema, &columns_to_skip))
}

/// Resolves an `Expr::Wildcard` to a collection of qualified `Expr::Column`'s.
Expand Down Expand Up @@ -464,7 +464,7 @@ pub fn expand_qualified_wildcard(
columns_to_skip.extend(excluded_columns);
Ok(get_exprs_except_skipped(
&qualified_dfschema,
columns_to_skip,
&columns_to_skip,
))
}

Expand Down Expand Up @@ -928,6 +928,7 @@ pub fn find_valid_equijoin_key_pair(
/// round(Float64)
/// round(Float32)
/// ```
#[allow(clippy::needless_pass_by_value)]
pub fn generate_signature_error_msg(
func_name: &str,
func_signature: Signature,
Expand Down
Loading