Rui Wang created SPARK-39548:
--------------------------------

             Summary: CreateView Command with a window clause query hit a wrong 
window definition not found issue.
                 Key: SPARK-39548
                 URL: https://issues.apache.org/jira/browse/SPARK-39548
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.3.0
            Reporter: Rui Wang


This query will hit a w2 window definition not found in `WindowSubstitute` 
rule, however this is a bug since the w2 definition is defined in the query.

```
create or replace temporary view test_temp_view as
with step_1 as (
select * , min(a) over w2 as min_a_over_w2 from (select 1 as a, 2 as b, 3 as c) 
window w2 as (partition by b order by c)) , step_2 as
(
select *, max(e) over w1 as max_a_over_w1
from (select 1 as e, 2 as f, 3 as g)
join step_1 on true
window w1 as (partition by f order by g)
)
select *
from step_2
```


Also we can move the unresolved window expression check from `WindowSubstitute` 
rule  to `CheckAnalysis` phrase.




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to