Jimexist commented on a change in pull request #334: URL: https://github.com/apache/arrow-datafusion/pull/334#discussion_r636187884
########## File path: datafusion/src/logical_plan/builder.rs ########## @@ -289,6 +288,37 @@ impl LogicalPlanBuilder { })) } + /// Apply a window + pub fn window( + &self, + window_expr: impl IntoIterator<Item = Expr>, + // partition_by_expr: impl IntoIterator<Item = Expr>, + // order_by_expr: impl IntoIterator<Item = Expr>, + // window_frame: Option<WindowFrame>, + ) -> Result<Self> { + let window_expr = window_expr.into_iter().collect::<Vec<Expr>>(); + // let partition_by_expr = partition_by_expr.into_iter().collect::<Vec<Expr>>(); + // let order_by_expr = order_by_expr.into_iter().collect::<Vec<Expr>>(); + let all_expr = window_expr.iter(); + validate_unique_names("Windows", all_expr.clone(), self.plan.schema())?; + + let mut window_fields: Vec<DFField> = + exprlist_to_fields(all_expr, self.plan.schema())?; + window_fields.extend_from_slice(self.plan.schema().fields()); + + Ok(Self::from(&LogicalPlan::Window { + input: Arc::new(self.plan.clone()), + // FIXME implement next + // partition_by_expr, + // FIXME implement next + // order_by_expr, + // FIXME implement next + // window_frame, + window_expr, Review comment: I'll leave a comment for now. btw `function.filter` needs to be added in the upstream `sqlparser` crate. -- 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: us...@infra.apache.org