Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
liurenjie1024 committed Mar 25, 2024
1 parent 4ed105f commit b122581
Showing 1 changed file with 45 additions and 56 deletions.
101 changes: 45 additions & 56 deletions datafusion/expr/src/logical_plan/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
LogicalPlan::TableScan(TableScan {
ref source,
ref table_name,
ref filters,
ref fetch,
..
}) => {
ref source,
ref table_name,
ref filters,
ref fetch,
..
}) => {
let mut object = json!({
"Node Type": "TableScan",
"Relation Name": table_name.table(),
Expand Down Expand Up @@ -387,21 +387,13 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
}

if !full_filter.is_empty() {
object["Full Filters"] = serde_json::Value::String(format!(
"{}",
expr_vec_fmt!(full_filter)
));
object["Full Filters"] = serde_json::Value::String(expr_vec_fmt!(full_filter).to_string());
};
if !partial_filter.is_empty() {
object["Partial Filters"] = serde_json::Value::String(format!(
"{}",
expr_vec_fmt!(partial_filter)
));
object["Partial Filters"] = serde_json::Value::String(expr_vec_fmt!(partial_filter).to_string());
}
if !unsupported_filters.is_empty() {
object["Unsupported Filters"] = serde_json::Value::String(
format!("{}", expr_vec_fmt!(unsupported_filters)),
);
object["Unsupported Filters"] = serde_json::Value::String(expr_vec_fmt!(unsupported_filters).to_string());
}
}

Expand All @@ -425,12 +417,12 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
LogicalPlan::Copy(CopyTo {
input: _,
output_url,
file_format,
partition_by: _,
copy_options,
}) => {
input: _,
output_url,
file_format,
partition_by: _,
copy_options,
}) => {
let op_str = match copy_options {
CopyOptions::SQLOptions(statement) => statement
.clone()
Expand All @@ -456,27 +448,27 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
LogicalPlan::Filter(Filter {
predicate: ref expr,
..
}) => {
predicate: ref expr,
..
}) => {
json!({
"Node Type": "Filter",
"Condition": format!("{}", expr)
})
}
LogicalPlan::Window(Window {
ref window_expr, ..
}) => {
ref window_expr, ..
}) => {
json!({
"Node Type": "WindowAggr",
"Expressions": expr_vec_fmt!(window_expr)
})
}
LogicalPlan::Aggregate(Aggregate {
ref group_expr,
ref aggr_expr,
..
}) => {
ref group_expr,
ref aggr_expr,
..
}) => {
json!({
"Node Type": "Aggregate",
"Group By": expr_vec_fmt!(group_expr),
Expand All @@ -496,12 +488,12 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
object
}
LogicalPlan::Join(Join {
on: ref keys,
filter,
join_constraint,
join_type,
..
}) => {
on: ref keys,
filter,
join_constraint,
join_type,
..
}) => {
let join_expr: Vec<String> =
keys.iter().map(|(l, r)| format!("{l} = {r}")).collect();
let filter_expr = filter
Expand All @@ -521,9 +513,9 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
LogicalPlan::Repartition(Repartition {
partitioning_scheme,
..
}) => match partitioning_scheme {
partitioning_scheme,
..
}) => match partitioning_scheme {
Partitioning::RoundRobinBatch(n) => {
json!({
"Node Type": "Repartition",
Expand Down Expand Up @@ -553,10 +545,10 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
}
},
LogicalPlan::Limit(Limit {
ref skip,
ref fetch,
..
}) => {
ref skip,
ref fetch,
..
}) => {
let mut object = serde_json::json!(
{
"Node Type": "Limit",
Expand Down Expand Up @@ -592,21 +584,18 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
Distinct::On(DistinctOn {
on_expr,
select_expr,
sort_expr,
..
}) => {
on_expr,
select_expr,
sort_expr,
..
}) => {
let mut object = json!({
"Node Type": "DistinctOn",
"On": expr_vec_fmt!(on_expr),
"Select": expr_vec_fmt!(select_expr),
});
if let Some(sort_expr) = sort_expr {
object["Sort"] = serde_json::Value::String(format!(
"{}",
expr_vec_fmt!(sort_expr)
));
object["Sort"] = serde_json::Value::String(expr_vec_fmt!(sort_expr).to_string());
}

object
Expand Down Expand Up @@ -634,8 +623,8 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
})
}
LogicalPlan::Prepare(Prepare {
name, data_types, ..
}) => {
name, data_types, ..
}) => {
json!({
"Node Type": "Prepare",
"Name": name,
Expand Down

0 comments on commit b122581

Please sign in to comment.