Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
  • Loading branch information
2 people authored and Jiayu Liu committed Jun 9, 2021
1 parent 3b289d8 commit 1b38ae2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion datafusion/src/optimizer/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub fn rewrite_expression(expr: &Expr, expressions: &[Expr]) -> Result<Expr> {

if partition_index >= sort_index {
Err(DataFusionError::Internal(
"Ill-formed window function expressions".to_owned(),
"Ill-formed window function expressions: partition index too large".to_owned(),
))
} else {
Ok(Expr::WindowFunction {
Expand Down
54 changes: 27 additions & 27 deletions datafusion/src/sql/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,35 +1139,35 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
.as_ref()
.map(|window_frame| window_frame.clone().try_into())
.transpose()?;
let fun = window_functions::WindowFunction::from_str(&name);
if let Ok(window_functions::WindowFunction::AggregateFunction(
aggregate_fun,
)) = fun
{
return Ok(Expr::WindowFunction {
fun: window_functions::WindowFunction::AggregateFunction(
aggregate_fun.clone(),
),
args: self.aggregate_fn_to_expr(&aggregate_fun, function)?,
partition_by,
order_by,
window_frame,
});
} else if let Ok(
let fun = window_functions::WindowFunction::from_str(&name)?;
match fun {
window_functions::WindowFunction::AggregateFunction(
aggregate_fun,
) => {
return Ok(Expr::WindowFunction {
fun: window_functions::WindowFunction::AggregateFunction(
aggregate_fun.clone(),
),
args: self
.aggregate_fn_to_expr(&aggregate_fun, function)?,
partition_by,
order_by,
window_frame,
});
}
window_functions::WindowFunction::BuiltInWindowFunction(
window_fun,
),
) = fun
{
return Ok(Expr::WindowFunction {
fun: window_functions::WindowFunction::BuiltInWindowFunction(
window_fun,
),
args: self.function_args_to_expr(function)?,
partition_by,
order_by,
window_frame,
});
) => {
return Ok(Expr::WindowFunction {
fun: window_functions::WindowFunction::BuiltInWindowFunction(
window_fun,
),
args: self.function_args_to_expr(function)?,
partition_by,
order_by,
window_frame,
});
}
}
}

Expand Down

0 comments on commit 1b38ae2

Please sign in to comment.