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 2021/04/15 04:06:28 UTC

[GitHub] [spark] allisonwang-db commented on a change in pull request #32179: [SPARK-35080][SQL] Only allow a subset of correlated equality predicates when a subquery is aggregated

allisonwang-db commented on a change in pull request #32179:
URL: https://github.com/apache/spark/pull/32179#discussion_r613741888



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -950,9 +950,15 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
       case f: Filter =>
         val (correlated, _) = splitConjunctivePredicates(f.condition).partition(containsOuter)
 
-        // Find any non-equality correlated predicates
+        // Find any non-equality correlated predicates and equality predicates that do not
+        // guarantee one-on-one mapping between inner and outer attributes. E.G:
+        // a = outer(c) -> true
+        // a > outer(c) -> false
+        // a + b = outer(c) -> false (because there can be multiple combinations of a, b that
+        // satisfy the condition)
         foundNonEqualCorrelatedPred = foundNonEqualCorrelatedPred || correlated.exists {
-          case _: EqualTo | _: EqualNullSafe => false
+          case Equality(_: Attribute, b) => b.find(_.isInstanceOf[Attribute]).isDefined

Review comment:
       Will do!




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



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