Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-30374 Feature Parity between PostgreSQL and Spark (ANSI/SQL)
  3. SPARK-30707

Lead/Lag window function throws AnalysisException without ORDER BY clause

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • SQL
    • None

    Description

       Lead/Lag window function throws AnalysisException without ORDER BY clause:

      SELECT lead(ten, four + 1) OVER (PARTITION BY four), ten, four
      FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s
      org.apache.spark.sql.AnalysisException
      Window function lead(ten#x, (four#x + 1), null) requires window to be ordered, please add ORDER BY clause. For example SELECT lead(ten#x, (four#x + 1), null)(value_expr) OVER (PARTITION BY window_partition ORDER BY window_ordering) from table;
      

       

      Maybe we need fix this issue.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              beliefer Jiaan Geng
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: