You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/20 07:08:48 UTC

[GitHub] [spark] dilipbiswal commented on a change in pull request #24118: [SPARK-26736][SQL] if filter condition `And` has non-determined sub function it does not do partition prunning

dilipbiswal commented on a change in pull request #24118: [SPARK-26736][SQL] if filter condition `And` has non-determined sub function it does not do partition prunning
URL: https://github.com/apache/spark/pull/24118#discussion_r267206675
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ##########
 @@ -63,10 +63,27 @@ object PhysicalOperation extends PredicateHelper {
         val substitutedFields = fields.map(substitute(aliases)).asInstanceOf[Seq[NamedExpression]]
         (Some(substitutedFields), filters, other, collectAliases(substitutedFields))
 
-      case Filter(condition, child) if condition.deterministic =>
-        val (fields, filters, other, aliases) = collectProjectsAndFilters(child)
-        val substitutedCondition = substitute(aliases)(condition)
-        (fields, filters ++ splitConjunctivePredicates(substitutedCondition), other, aliases)
+      case filter: Filter if filter.condition.deterministic || filter.condition.isInstanceOf[And] =>
+        val condition = filter.condition
+        val determinedCondition = if (condition.deterministic) {
+          Some(condition)
+        } else {
+          val andCondition = condition.asInstanceOf[And]
+          if (andCondition.left.deterministic) {
 
 Review comment:
   Do we intend to handle only at the top level ? What happens when the non-deterministic predicate is nested like : 
   ```
   where ((c1 = 10 and rand() < 1) and (c2 = 20))
   ```
   in this case, in my understanding of the code, we will ignore (c1 = 10) for pruning purposes ? cc @maropu 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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