Wan Kun created SPARK-41805:
-------------------------------

             Summary: Reuse expressions in WindowSpecDefinition
                 Key: SPARK-41805
                 URL: https://issues.apache.org/jira/browse/SPARK-41805
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.4.0
            Reporter: Wan Kun


For complex expressions in window spec definition, we extract it and replace it 
with an AttributeReference (with an internal column name, e.g. "_w0").
We can reuse the extracted expressions to avoid generator unnecessary Window 
node.

For example: the logical plan of query
{code:sql}
SELECT max(value) over(partition by (key) order by cast(ts as timestamp)) as w1,
               min(value) over(partition by (key) order by cast(ts as 
timestamp)) as w2
FROM t1
{code}
contains two Window node.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to