Dylan Guedes created SPARK-28068:
------------------------------------

             Summary: `lag` second argument must be a literal
                 Key: SPARK-28068
                 URL: https://issues.apache.org/jira/browse/SPARK-28068
             Project: Spark
          Issue Type: Task
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: Dylan Guedes


Currently in Spark, `lag` (and, possible, some other window functions) requires 
the 2nd argument to be a literal.
For example, this is not allowed:

{code:sql}
SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM 
tenk1 WHERE unique2 < 10;
{code}
However, this one works:

{code:sql}
SELECT lag(ten, 2) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 
WHERE unique2 < 10;
{code}

In comparison, Postgres accepts a literal as a 2nd argument. I found this issue 
while porting `window.sql` tests from Postgres to Spark



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to