@@ -34,7 +34,7 @@ class FilterPushdownSuite extends PlanTest {
3434 object Optimize extends RuleExecutor [LogicalPlan ] {
3535
3636 override protected val blacklistedOnceBatches : Set [String ] =
37- Set (" Push predicate through join by CNF " )
37+ Set (" Push CNF predicate through join" )
3838
3939 val batches =
4040 Batch (" Subqueries" , Once ,
@@ -45,7 +45,7 @@ class FilterPushdownSuite extends PlanTest {
4545 BooleanSimplification ,
4646 PushPredicateThroughJoin ,
4747 CollapseProject ) ::
48- Batch (" Push predicate through join by CNF " , Once ,
48+ Batch (" Push CNF predicate through join" , Once ,
4949 PushCNFPredicateThroughJoin ) :: Nil
5050 }
5151
@@ -1340,26 +1340,6 @@ class FilterPushdownSuite extends PlanTest {
13401340 comparePlans(optimized, correctAnswer)
13411341 }
13421342
1343- test(" inner join: rewrite to conjunctive normal form avoid generating too many predicates" ) {
1344- val x = testRelation.subquery(' x )
1345- val y = testRelation.subquery(' y )
1346-
1347- val originalQuery = {
1348- x.join(y, condition = Some ((" x.b" .attr === " y.b" .attr)
1349- && (((" x.a" .attr > 3 ) && (" x.a" .attr < 13 ) && (" y.c" .attr <= 5 ))
1350- || ((" y.a" .attr > 2 ) && (" y.c" .attr < 1 )))))
1351- }
1352-
1353- val optimized = Optimize .execute(originalQuery.analyze)
1354- val left = testRelation.subquery(' x )
1355- val right = testRelation.where(' c <= 5 || (' a > 2 && ' c < 1 )).subquery(' y )
1356- val correctAnswer = left.join(right, condition = Some (" x.b" .attr === " y.b" .attr
1357- && (((" x.a" .attr > 3 ) && (" x.a" .attr < 13 ) && (" y.c" .attr <= 5 ))
1358- || ((" y.a" .attr > 2 ) && (" y.c" .attr < 1 ))))).analyze
1359-
1360- comparePlans(optimized, correctAnswer)
1361- }
1362-
13631343 test(s " Disable rewrite to CNF by setting ${SQLConf .MAX_CNF_NODE_COUNT .key}=0 " ) {
13641344 val x = testRelation.subquery(' x )
13651345 val y = testRelation.subquery(' y )
@@ -1370,14 +1350,14 @@ class FilterPushdownSuite extends PlanTest {
13701350 || ((" y.a" .attr > 2 ) && (" y.c" .attr < 1 )))))
13711351 }
13721352
1373- Seq (0 , 10 ).foreach { depth =>
1374- withSQLConf(SQLConf .MAX_CNF_NODE_COUNT .key -> depth .toString) {
1353+ Seq (0 , 10 ).foreach { count =>
1354+ withSQLConf(SQLConf .MAX_CNF_NODE_COUNT .key -> count .toString) {
13751355 val optimized = Optimize .execute(originalQuery.analyze)
1376- val (left, right) = if (depth == 0 ) {
1356+ val (left, right) = if (count == 0 ) {
13771357 (testRelation.subquery(' x ), testRelation.subquery(' y ))
13781358 } else {
13791359 (testRelation.subquery(' x ),
1380- testRelation.where(' c <= 5 || ( ' a > 2 && ' c < 1 )).subquery(' y ))
1360+ testRelation.where(( ' c <= 5 || ' c < 1 ) && ( ' c <= 5 || ' a > 2 )).subquery(' y ))
13811361 }
13821362 val correctAnswer = left.join(right, condition = Some (" x.b" .attr === " y.b" .attr
13831363 && (((" x.a" .attr > 3 ) && (" x.a" .attr < 13 ) && (" y.c" .attr <= 5 ))
0 commit comments