Skip to content

Commit

Permalink
cargo clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Dec 18, 2024
1 parent 7c5e3e3 commit 310d4f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
7 changes: 2 additions & 5 deletions datafusion/sql/src/unparser/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,8 @@ impl Unparser<'_> {
fn is_unnest_placeholder_with_outer_ref(expr: &Expr) -> (bool, bool) {
if let Expr::Alias(Alias { expr, .. }) = expr {
if let Expr::Column(Column { name, .. }) = expr.as_ref() {
if name.starts_with(UNNEST_PLACEHOLDER) {
return (
true,
name[UNNEST_PLACEHOLDER.len()..].starts_with("(outer_ref("),
);
if let Some(prefix) = name.strip_prefix(UNNEST_PLACEHOLDER) {
return (true, prefix.starts_with("(outer_ref("));
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions datafusion/sql/src/unparser/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,9 @@ pub(super) fn find_unnest_column_alias(
if projection.expr.len() != 1 {
return (plan, None);
}
if let Some(expr) = projection.expr.get(0) {
if let Expr::Alias(alias) = expr {
if alias.expr.schema_name().to_string().starts_with("UNNEST(") {
return (projection.input.as_ref(), Some(alias.name.clone()));
}
if let Some(Expr::Alias(alias)) = projection.expr.first() {
if alias.expr.schema_name().to_string().starts_with("UNNEST(") {
return (projection.input.as_ref(), Some(alias.name.clone()));
}
}
}
Expand Down

0 comments on commit 310d4f0

Please sign in to comment.