Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
timsaucer committed Sep 11, 2024
1 parent ffbda4c commit 910985d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions datafusion/core/src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,12 +1452,12 @@ impl DataFrame {
pub fn with_column(self, name: &str, expr: Expr) -> Result<DataFrame> {
let window_func_exprs = find_window_exprs(&[expr.clone()]);

let ( window_fn_str, plan) = if window_func_exprs.is_empty() {
let (window_fn_str, plan) = if window_func_exprs.is_empty() {
(None, self.plan)
} else {
(
Some(window_func_exprs[0].to_string()),
LogicalPlanBuilder::window_plan(self.plan, window_func_exprs)?
LogicalPlanBuilder::window_plan(self.plan, window_func_exprs)?,
)
};

Expand All @@ -1472,7 +1472,10 @@ impl DataFrame {
Some(new_column.clone())
} else {
let e = col(Column::from((qualifier, field)));
let match_window_fn = window_fn_str.as_ref().map(|s| s == &e.to_string()).unwrap_or(false);
let match_window_fn = window_fn_str
.as_ref()
.map(|s| s == &e.to_string())
.unwrap_or(false);
match match_window_fn {
true => None,
false => Some(e),
Expand Down Expand Up @@ -2987,7 +2990,7 @@ mod tests {
let df_impl = DataFrame::new(ctx.state(), df.plan.clone());
let func = row_number().alias("row_num");

// This first `with_column` results in a column without a `qualifier`
// This first `with_column` results in a column without a `qualifier`
let df_impl = df_impl.with_column("s", col("c2") + col("c3"))?;

// This second `with_column` then assigns `"r"` alias to the above column and the window function
Expand Down

0 comments on commit 910985d

Please sign in to comment.