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/03/08 02:58:15 UTC

[GitHub] [spark] maropu commented on a change in pull request #31712: [SPARK-34598] RewritePredicateSubquery Rule must not update Filters without subqueries

maropu commented on a change in pull request #31712:
URL: https://github.com/apache/spark/pull/31712#discussion_r589142505



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/RewriteSubquerySuite.scala
##########
@@ -67,4 +68,12 @@ class RewriteSubquerySuite extends PlanTest {
 
     comparePlans(optimized, correctAnswer)
   }
+
+  test("SPARK-34598: Filters without subquery must not be modified by RewritePredicateSubquery") {
+    val relation = LocalRelation('a.int, 'b.int, 'c.int, 'd.int)
+    val query = relation.where(('a === 1 || 'b === 2) && ('c === 3 && 'd === 4)).select('a)
+    val tracker = new QueryPlanningTracker
+    Optimize.executeAndTrack(query.analyze, tracker)
+    assert(tracker.rules.get(RewritePredicateSubquery.ruleName).get.numEffectiveInvocations == 0)

Review comment:
       nit: `assert(tracker.rules(RewritePredicateSubquery.ruleName).numEffectiveInvocations == 0)`




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