Gengliang Wang created SPARK-25979:
--------------------------------------
Summary: Window function: allow parentheses around window reference
Key: SPARK-25979
URL: https://issues.apache.org/jira/browse/SPARK-25979
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 3.0.0
Reporter: Gengliang Wang
Very minor parser bug, but possibly problematic for code-generated queries:
Consider the following two queries:
{code}
SELECT avg(k) OVER (w) FROM kv WINDOW w AS (PARTITION BY v ORDER BY w) ORDER BY
1
{code}
and
{code}
SELECT avg(k) OVER w FROM kv WINDOW w AS (PARTITION BY v ORDER BY w) ORDER BY 1
{code}
The former, with parens around the OVER condition, fails to parse while the
latter, without parens, succeeds:
{code}
Error in SQL statement: ParseException:
mismatched input '(' expecting {<EOF>, ',', 'FROM', 'WHERE', 'GROUP', 'ORDER',
'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'MINUS',
'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 1, pos 19)
== SQL ==
SELECT avg(k) OVER (w) FROM kv WINDOW w AS (PARTITION BY v ORDER BY w) ORDER BY
1
-------------------^^^
{code}
This was found when running the cockroach DB tests.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]