Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-39548

CreateView Command with a window clause query hit a wrong window definition not found issue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.2.2, 3.3.1, 3.4.0
    • SQL
    • None

    Description

      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.

      Attachments

        Activity

          People

            amaliujia Rui Wang
            amaliujia Rui Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: