Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11635#discussion_r60421291
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -958,6 +958,26 @@ object PushDownPredicate extends Rule[LogicalPlan] 
with PredicateHelper {
     
           project.copy(child = Filter(replaceAlias(condition, aliasMap), 
grandChild))
     
    +    // Push [[Filter]] operators through [[Window]] operators. Parts of 
the predicate that can be
    +    // pushed beneath must satisfy three conditions:
    +    // 1. involving one and only one column that is part of window 
partitioning key.
    --- End diff --
    
    So I am not sure I agree with you here.
    
    Lets take your example. We filter the rows  with the following predicate: 
`key + value > 2`. We use both `key` and `value` in `PARTITION BY` clause, this 
means they are constant during window function evaluation. The value of `key + 
value > 1` will (as a result) also be constant during window evaluation. This 
predicate would filter out entire partitions, so we can safely push it down.
    
    I think we can safely push down any deterministic filter which only 
references partitioning columns. Let me know what you think.
    
    I am not sure why Hive does not push this down, but this could well be due 
to the way Hive evaluates window functions (PTFs).



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to