2010YOUY01 commented on code in PR #15033:
URL: https://github.com/apache/datafusion/pull/15033#discussion_r1996542785
##########
datafusion/sql/src/select.rs:
##########
@@ -887,29 +888,42 @@ fn match_window_definitions(
named_windows: &[NamedWindowDefinition],
) -> Result<()> {
for proj in projection.iter_mut() {
- if let SelectItem::ExprWithAlias {
- expr: SQLExpr::Function(f),
- alias: _,
- }
- | SelectItem::UnnamedExpr(SQLExpr::Function(f)) = proj
+ if let SelectItem::ExprWithAlias { expr, alias: _ }
+ | SelectItem::UnnamedExpr(expr) = proj
{
- for NamedWindowDefinition(window_ident, window_expr) in
named_windows.iter() {
- if let Some(WindowType::NamedWindow(ident)) = &f.over {
- if ident.eq(window_ident) {
- f.over = Some(match window_expr {
- NamedWindowExpr::NamedWindow(ident) => {
- WindowType::NamedWindow(ident.clone())
- }
- NamedWindowExpr::WindowSpec(spec) => {
- WindowType::WindowSpec(spec.clone())
+ let mut err = None;
+ visit_expressions_mut(expr, |expr| {
Review Comment:
DuckDB interprets it as `(SUM(t1.v1) OVER w) + 1`, and `... OVER (w + 1)` is
not valid
```
D SELECT
t1.v1,
SUM(t1.v1) OVER (w + 1)
FROM
generate_series(1, 10) AS t1(v1)
WINDOW
w AS (ORDER BY t1.v1);
Parser Error: syntax error at or near "+"
LINE 3: SUM(t1.v1) OVER (w + 1)
```
--
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]