devinjdangelo commented on code in PR #10767: URL: https://github.com/apache/datafusion/pull/10767#discussion_r1624273646
########## datafusion/sql/src/unparser/utils.rs: ########## @@ -82,3 +91,28 @@ pub(crate) fn unproject_agg_exprs(expr: &Expr, agg: &Aggregate) -> Result<Expr> }) .map(|e| e.data) } + +/// Recursively identify all Column expressions and transform them into the appropriate +/// window expression contained in window. +/// +/// For example, if expr contains the column expr "COUNT(*) PARTITION BY id" it will be transformed +/// into an actual window expression as identified in the window node. +pub(crate) fn unproject_window_exprs(expr: &Expr, window: &Window) -> Result<Expr> { Review Comment: It turns out another difference is there can be multiple Window nodes representing different WindowSpecs within the same select query. I had to make a few additional tweaks to handle this case. -- 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. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org