Github user gatorsmile commented on the pull request:

    https://github.com/apache/spark/pull/11555#issuecomment-194322107
  
    For example, the following query
    ```scala
        sqlContext
          .range(10)
          .select('id as 'key, 'id as 'value)
          .write
          .saveAsTable("test1")
        sqlContext
          .range(10)
          .select('id as 'key, 'id as 'value)
          .write
          .saveAsTable("test2")
        sql("SELECT sum(a.value) over (ORDER BY a.key), sum(b.value) over 
(ORDER BY b.key) FROM test1 a JOIN test2 b ON a.key = b.key").explain(true)
    ```
    
    The plan will be like
    ```
    +- Project 
[value#29L,key#28L,value#31L,key#30L,windowexpression(sum(value), 
windowspecdefinition(sortorder(key)))#35L,windowexpression(sum(value), 
windowspecdefinition(sortorder(key)))#36L,windowexpression(sum(value), 
windowspecdefinition(sortorder(key)))#35L,windowexpression(sum(value), 
windowspecdefinition(sortorder(key)))#36L]
       +- Window 
[value#29L,key#28L,value#31L,key#30L,windowexpression(sum(value), 
windowspecdefinition(sortorder(key)))#35L], 
[(sum(value#31L),mode=Complete,isDistinct=false) windowspecdefinition(key#30L 
ASC, RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS 
windowexpression(sum(value), windowspecdefinition(sortorder(key)))#36L], 
[key#30L ASC]
          +- Window [value#29L,key#28L,value#31L,key#30L], 
[(sum(value#29L),mode=Complete,isDistinct=false) windowspecdefinition(key#28L 
ASC, RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS 
windowexpression(sum(value), windowspecdefinition(sortorder(key)))#35L], 
[key#28L ASC]
             +- Project [value#29L,key#28L,value#31L,key#30L]
                +- Join Inner, Some((key#28L = key#30L))
                   :- SubqueryAlias a
                   :  +- SubqueryAlias test1
                   :     +- Relation[key#28L,value#29L] ParquetRelation
                   +- SubqueryAlias b
                      +- SubqueryAlias test2
                         +- Relation[key#30L,value#31L] ParquetRelation
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to