You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Lauri Koobas (Jira)" <ji...@apache.org> on 2021/11/30 08:23:00 UTC

[jira] [Updated] (SPARK-37500) Incorrect scope when using named_windows in CTEs

     [ https://issues.apache.org/jira/browse/SPARK-37500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lauri Koobas updated SPARK-37500:
---------------------------------
    Description: 
This works, but shouldn't. The named_window is described outside the CTE that uses it.

    with step_1 as (
      select *
  , min(a) over w1 as min_a_over_w1
  from (select 1 as a, 2 as b, 3 as c)
)
select *
from step_1
window w1 as (partition by b order by c)

 

  was:
This works, but shouldn't. The named_window is described outside the CTE that uses it.

```with step_1 as (
  select *
  , min(a) over w1 as min_a_over_w1
  from (select 1 as a, 2 as b, 3 as c)
)
select *
from step_1
window w1 as (partition by b order by c)

```


> Incorrect scope when using named_windows in CTEs
> ------------------------------------------------
>
>                 Key: SPARK-37500
>                 URL: https://issues.apache.org/jira/browse/SPARK-37500
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.1.2, 3.2.0
>         Environment: Databricks Runtime 9.0, 9.1, 10.0
>            Reporter: Lauri Koobas
>            Priority: Major
>
> This works, but shouldn't. The named_window is described outside the CTE that uses it.
>     with step_1 as (
>       select *
>   , min(a) over w1 as min_a_over_w1
>   from (select 1 as a, 2 as b, 3 as c)
> )
> select *
> from step_1
> window w1 as (partition by b order by c)
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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