Jimexist commented on a change in pull request #501:
URL: https://github.com/apache/arrow-datafusion/pull/501#discussion_r647894204



##########
File path: datafusion/src/sql/planner.rs
##########
@@ -1121,52 +1121,53 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
 
                 // then, window function
                 if let Some(window) = &function.over {
-                    if window.partition_by.is_empty() {
-                        let order_by = window
-                            .order_by
-                            .iter()
-                            .map(|e| self.order_by_to_sort_expr(e))
-                            .into_iter()
-                            .collect::<Result<Vec<_>>>()?;
-                        let window_frame = window
-                            .window_frame
-                            .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)?,
-                                order_by,
-                                window_frame,
-                            });
-                        } else if let Ok(
-                            
window_functions::WindowFunction::BuiltInWindowFunction(
+                    let partition_by = window
+                        .partition_by
+                        .iter()
+                        .map(|e| self.sql_expr_to_logical_expr(e))
+                        .into_iter()
+                        .collect::<Result<Vec<_>>>()?;
+                    let order_by = window
+                        .order_by
+                        .iter()
+                        .map(|e| self.order_by_to_sort_expr(e))
+                        .into_iter()
+                        .collect::<Result<Vec<_>>>()?;
+                    let window_frame = window
+                        .window_frame
+                        .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(

Review comment:
       fixed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to