Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kmitchener committed Aug 29, 2022
1 parent ab0f9ae commit f395f77
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions datafusion/optimizer/src/decorrelate_scalar_subquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ impl DecorrelateScalarSubquery {
for it in filters.iter() {
match it {
Expr::BinaryExpr { left, op, right } => {
let l_query = Subquery::try_from_expr(&left);
let r_query = Subquery::try_from_expr(&right);
let l_query = Subquery::try_from_expr(left);
let r_query = Subquery::try_from_expr(right);
if l_query.is_err() && r_query.is_err() {
others.push((*it).clone());
continue;
Expand Down Expand Up @@ -194,25 +194,24 @@ fn optimize_scalar(
let filter = Filter::try_from_plan(&aggr.input).ok();

// if there were filters, we use that logical plan, otherwise the plan from the aggregate
let input: &LogicalPlan;
if filter.is_some() {
input = &filter.unwrap().input;
let input = if let Some(filter) = filter {
&filter.input
} else {
input = &aggr.input;
&aggr.input
};

// if there were filters, split and capture them
let mut subqry_filter_exprs = vec![];
if filter.is_some() {
split_conjunction(&filter.unwrap().predicate, &mut subqry_filter_exprs);
if let Some(filter) = filter {
split_conjunction(&filter.predicate, &mut subqry_filter_exprs);
}
verify_not_disjunction(&subqry_filter_exprs)?;

// Grab column names to join on
let (col_exprs, other_subqry_exprs) =
find_join_exprs(subqry_filter_exprs, *&input.schema())?;
find_join_exprs(subqry_filter_exprs, input.schema())?;
let (outer_cols, subqry_cols, join_filters) =
exprs_to_join_cols(&col_exprs, *&input.schema(), false)?;
exprs_to_join_cols(&col_exprs, input.schema(), false)?;
if join_filters.is_some() {
plan_err!("only joins on column equality are presently supported")?;
}
Expand All @@ -225,7 +224,7 @@ fn optimize_scalar(
.collect();

// build subquery side of join - the thing the subquery was querying
let mut subqry_plan = LogicalPlanBuilder::from((*input).clone());
let mut subqry_plan = LogicalPlanBuilder::from((**input).clone());
if let Some(expr) = combine_filters(&other_subqry_exprs) {
subqry_plan = subqry_plan.filter(expr)? // if the subquery had additional expressions, restore them
}
Expand Down

0 comments on commit f395f77

Please sign in to comment.