Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13585#discussion_r66733226
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala ---
    @@ -65,15 +65,20 @@ private[hive] trait HiveStrategies {
             // hive table scan operator to be used for partition pruning.
             val partitionKeyIds = AttributeSet(relation.partitionKeys)
             val (pruningPredicates, otherPredicates) = predicates.partition { 
predicate =>
    -          !predicate.references.isEmpty &&
    +          predicate.references.nonEmpty &&
               predicate.references.subsetOf(partitionKeyIds)
             }
    +        val additionalPartPredicates =
    +          PhysicalOperation.partitionPrunningFromDisjunction(
    +            otherPredicates.foldLeft[Expression](Literal(true))(And(_, 
_)), partitionKeyIds)
     
             pruneFilterProject(
               projectList,
               otherPredicates,
               identity[Seq[Expression]],
    -          HiveTableScanExec(_, relation, pruningPredicates)(sparkSession)) 
:: Nil
    +        HiveTableScanExec(_,
    +            relation,
    +            pruningPredicates ++ additionalPartPredicates)(sparkSession)) 
:: Nil
    --- End diff --
    
    @yangw1234 @liancheng @clockfly 
    `pruningPredicates ++ additionalPartPredicates` is the partition filter, 
and, the original filter still need to be applied after the partition pruned.


---
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