You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/03/16 01:24:33 UTC

[jira] [Assigned] (SPARK-13919) Resolving the Conflicts of ColumnPruning and PushPredicateThroughProject

     [ https://issues.apache.org/jira/browse/SPARK-13919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Apache Spark reassigned SPARK-13919:
------------------------------------

    Assignee:     (was: Apache Spark)

> Resolving the Conflicts of ColumnPruning and PushPredicateThroughProject 
> -------------------------------------------------------------------------
>
>                 Key: SPARK-13919
>                 URL: https://issues.apache.org/jira/browse/SPARK-13919
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Xiao Li
>
> Now, {{ColumnPruning}} and {{PushPredicateThroughProject}} reverse each other's effect. Although it will not cause the max iteration now, some queries are not optimized to the best. 
> For example, in the following query, 
> {code}
>     val input = LocalRelation('a.int, 'b.string, 'c.double, 'd.int)
>     val originalQuery =
>       input.select('a, 'b, 'c, 'd,
>         WindowExpression(
>           AggregateExpression(Count('b), Complete, isDistinct = false),
>           WindowSpecDefinition( 'a :: Nil,
>             SortOrder('b, Ascending) :: Nil,
>             UnspecifiedFrame)).as('window)).where('window > 1).select('a, 'c)
> {code}
> After multiple iteration of two rules of {{ColumnPruning}} and {{PushPredicateThroughProject}}, the optimized plan we generated is like:
> {code}
> Project [a#0,c#0]                                                                                                                                                                    
> +- Filter (window#0L > cast(1 as bigint))                                                                                                                                            
>    +- Project [a#0,c#0,window#0L]                                                                                                                                                    
>       +- Window [(count(b#0),mode=Complete,isDistinct=false) windowspecdefinition(a#0, b#0 ASC, RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS window#0L], [a#0], [b#0 ASC]   
>          +- LocalRelation [a#0,b#0,c#0,d#0]                                                                                                                                          
> {code}
> However, the expected optimized plan should be like:
> {code}
> Project [a#0,c#0]
> +- Filter (window#0L > cast(1 as bigint))
>    +- Project [a#0,c#0,window#0L]
>       +- Window [(count(b#0),mode=Complete,isDistinct=false) windowspecdefinition(a#0, b#0 ASC, RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS window#0L], [a#0], [b#0 ASC]
>          +- Project [a#0,b#0,c#0]
>             +- LocalRelation [a#0,b#0,c#0,d#0]                                                                                                                                          
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org