Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.0
-
None
-
None
Description
Currently in Spark, `lag` (and, possible, some other window functions) requires the 2nd argument to be a literal.
For example, this is not allowed:
SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10;
However, this one works:
SELECT lag(ten, 2) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10;
In comparison, Postgres accepts a literal as a 2nd argument. I found this issue while porting `window.sql` tests from Postgres to Spark