goutamadwant opened a new pull request, #26486: URL: https://github.com/apache/datafusion/pull/26486
## Which issue does this PR close? - Closes #25934 ## Rationale for this change Adding an option to an existing aggregate or window expression can silently reset options already set on that expression. For example, adding `DISTINCT` can discard `ORDER BY` and `FILTER`; adding a window partition can discard ordering. An implicit window frame must also be re-derived when `ORDER BY` changes, while an explicit frame must remain unchanged. ## What changes are included in this PR? - Seed `ExprFuncBuilder` from existing aggregate/window options and derive the default window frame from the final ordering. - Track whether a window frame was explicit through expression construction, SQL planning/unparsing, protobuf, and Substrait where representable. Keep this provenance bit out of expression equality, ordering, and hashing. - Add regression and round-trip tests, plus an upgrade guide note for the new public fields. Substrait cannot retain implicit-frame provenance for ordered default frames while preserving their execution behavior; those frames need explicit bounds on export. Older protobuf plans decode the new flag as `false` while retaining the resolved frame. ## What is the testing strategy for this PR? - Core expression/API tests: 43 passed, covering option chaining, frame provenance, and equality/hash behavior. - SQL round-trip and unparser tests: 47 and 38 passed. - Protobuf and Substrait window round-trip tests: 3 and 1 passed. - Rust formatting and documentation Prettier checks passed. Full-workspace Clippy passed with `clippy::mutable_key_type` allowed; the unmodified command reports that lint in existing `HashSet<&Expr>` uses in `datafusion/optimizer/src/push_down_filter.rs`, which this PR does not change. These are focused local tests; CI has not run for this branch. ## Are there any user-facing changes? Yes. Chained aggregate/window options are preserved, and implicit window frames update when ordering changes. `WindowFunctionParams` and `RawWindowExpr` gain a public `window_frame_explicit` field, so callers constructing these structs with literals must set it. The 56.0.0 upgrade guide documents this API change; please apply the `api change` label. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
