viirya commented on a change in pull request #33232:
URL: https://github.com/apache/spark/pull/33232#discussion_r665128760



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -1442,6 +1442,12 @@ object PushPredicateThroughNonJoin extends 
Rule[LogicalPlan] with PredicateHelpe
       pushDownPredicate(filter, u.child) { predicate =>
         u.withNewChildren(Seq(Filter(predicate, u.child)))
       }
+
+    // Push down filter predicates in case filter having child as TypedFilter.
+    // In this scenario inorder to push the filter predicates there is need to
+    // to push Filter beneath the TypedFilter.
+    case Filter(condition, typeFilter @ TypedFilter(_, _, _, _, _)) =>
+      typeFilter.copy(child = Filter(condition, typeFilter.child))

Review comment:
       To be safer here, we may exclude the possibility that users use 
non-deterministic typed filter function, actually.

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -1442,6 +1442,12 @@ object PushPredicateThroughNonJoin extends 
Rule[LogicalPlan] with PredicateHelpe
       pushDownPredicate(filter, u.child) { predicate =>
         u.withNewChildren(Seq(Filter(predicate, u.child)))
       }
+
+    // Push down filter predicates in case filter having child as TypedFilter.
+    // In this scenario inorder to push the filter predicates there is need to
+    // to push Filter beneath the TypedFilter.
+    case Filter(condition, typeFilter @ TypedFilter(_, _, _, _, _)) =>
+      typeFilter.copy(child = Filter(condition, typeFilter.child))

Review comment:
       To be safer here, we may not exclude the possibility that users use 
non-deterministic typed filter function, actually.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to