You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Gengliang Wang (JIRA)" <ji...@apache.org> on 2018/11/08 16:15:00 UTC

[jira] [Created] (SPARK-25979) Window function: allow parentheses around window reference

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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org