2010YOUY01 commented on code in PR #16234: URL: https://github.com/apache/datafusion/pull/16234#discussion_r2125366399
########## datafusion/physical-expr/src/window/aggregate.rs: ########## @@ -85,6 +88,25 @@ impl PlainAggregateWindowExpr { ); } } + + // Returns true if every row in the partition has the same window frame. This allows + // for preventing bound + function calculation for every row due to the values being the + // same. + // + // This occurs when both bounds fall under either condition below: + // 1. Bound is unbounded (`Preceding` or `Following`) + // 2. Bound is `CurrentRow` while using `Range` units with no order by clause Review Comment: ```suggestion // 2. Bound is `CurrentRow` while using `Range` units with no order by clause // This results in an invalid range specification. Following PostgreSQL’s convention, // we interpret this as the entire partition being used for the current window frame. ``` ########## datafusion/physical-expr/src/window/window_expr.rs: ########## @@ -186,6 +186,10 @@ pub trait AggregateWindowExpr: WindowExpr { accumulator: &mut Box<dyn Accumulator>, ) -> Result<ScalarValue>; + /// Indicates whether this window function always produces the same result + /// for all rows in the partition. + fn is_constant(&self) -> bool; Review Comment: ```suggestion fn is_constant_in_partition(&self) -> bool; ``` nit: It would be great to be more specific. -- 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