Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions rust/datafusion/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl ExecutionContext {
.map(|batch| writer.write(&batch?))
.try_collect()
.await
.map_err(|e| DataFusionError::from(e))?;
.map_err(DataFusionError::from)?;
}
Ok(())
}
Expand Down Expand Up @@ -415,7 +415,7 @@ impl ExecutionContext {
.map(|batch| writer.write(&batch?))
.try_collect()
.await
.map_err(|e| DataFusionError::from(e))?;
.map_err(DataFusionError::from)?;

writer.close()?;
}
Expand Down
4 changes: 0 additions & 4 deletions rust/datafusion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
clippy::new_without_default,
clippy::or_fun_call,
clippy::ptr_arg,
clippy::redundant_field_names,
clippy::redundant_static_lifetimes,
clippy::redundant_pattern_matching,
clippy::redundant_closure,
clippy::single_match,
clippy::stable_sort_primitive,
clippy::type_complexity,
Expand Down
5 changes: 2 additions & 3 deletions rust/datafusion/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ impl LogicalPlanBuilder {
let projected_schema = projection
.clone()
.map(|p| Schema::new(p.iter().map(|i| schema.field(*i).clone()).collect()));
let projected_schema =
projected_schema.map_or(schema.clone(), |s| SchemaRef::new(s));
let projected_schema = projected_schema.map_or(schema.clone(), SchemaRef::new);

Ok(Self::from(&LogicalPlan::ParquetScan {
path: path.to_owned(),
Expand All @@ -120,7 +119,7 @@ impl LogicalPlanBuilder {
Schema::new(p.iter().map(|i| table_schema.field(*i).clone()).collect())
});
let projected_schema =
projected_schema.map_or(table_schema.clone(), |s| SchemaRef::new(s));
projected_schema.map_or(table_schema.clone(), SchemaRef::new);

Ok(Self::from(&LogicalPlan::TableScan {
schema_name: schema_name.to_owned(),
Expand Down
8 changes: 4 additions & 4 deletions rust/datafusion/src/optimizer/projection_push_down.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ fn optimize_plan(
source: source.clone(),
table_schema: table_schema.clone(),
projection: Some(projection),
projected_schema: projected_schema,
projected_schema,
})
}
LogicalPlan::InMemoryScan {
Expand All @@ -282,7 +282,7 @@ fn optimize_plan(
data: data.clone(),
schema: schema.clone(),
projection: Some(projection),
projected_schema: projected_schema,
projected_schema,
})
}
LogicalPlan::CsvScan {
Expand All @@ -306,7 +306,7 @@ fn optimize_plan(
schema: schema.clone(),
delimiter: *delimiter,
projection: Some(projection),
projected_schema: projected_schema,
projected_schema,
})
}
LogicalPlan::ParquetScan {
Expand All @@ -326,7 +326,7 @@ fn optimize_plan(
path: path.to_owned(),
schema: schema.clone(),
projection: Some(projection),
projected_schema: projected_schema,
projected_schema,
})
}
LogicalPlan::Explain {
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub fn create_aggregate_expr(
})
}

static NUMERICS: &'static [DataType] = &[
static NUMERICS: &[DataType] = &[
DataType::Int8,
DataType::Int16,
DataType::Int32,
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/array_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn array(args: &[ArrayRef]) -> Result<ArrayRef> {
/// Currently supported types by the array function.
/// The order of these types correspond to the order on which coercion applies
/// This should thus be from least informative to most informative
pub static SUPPORTED_ARRAY_TYPES: &'static [DataType] = &[
pub static SUPPORTED_ARRAY_TYPES: &[DataType] = &[
DataType::Boolean,
DataType::UInt8,
DataType::UInt16,
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub async fn collect(stream: SendableRecordBatchStream) -> Result<Vec<RecordBatc
stream
.try_collect::<Vec<_>>()
.await
.map_err(|e| DataFusionError::from(e))
.map_err(DataFusionError::from)
}

/// Recursively build a list of files in a directory with a given extension
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ pub fn nullif_func(args: &[ArrayRef]) -> Result<ArrayRef> {
/// Currently supported types by the nullif function.
/// The order of these types correspond to the order on which coercion applies
/// This should thus be from least informative to most informative
pub static SUPPORTED_NULLIF_TYPES: &'static [DataType] = &[
pub static SUPPORTED_NULLIF_TYPES: &[DataType] = &[
DataType::Boolean,
DataType::UInt8,
DataType::UInt16,
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ mod tests {
#[test]
fn test_concat_error() -> Result<()> {
let result = return_type(&BuiltinScalarFunction::Concat, &vec![]);
if let Ok(_) = result {
if result.is_ok() {
Err(DataFusionError::Plan(
"Function 'concat' cannot accept zero arguments".to_string(),
))
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ impl DefaultPhysicalPlanner {
) -> Result<PhysicalSortExpr> {
Ok(PhysicalSortExpr {
expr: self.create_physical_expr(e, input_schema, ctx_state)?,
options: options,
options,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ mod tests {
];

for case in cases {
if let Ok(_) = coerce(&case.0, &case.1, &case.2) {
if coerce(&case.0, &case.1, &case.2).is_ok() {
return Err(DataFusionError::Plan(format!(
"Error was expected in {:?}",
case
Expand Down