Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
gengliangwang committed Jun 10, 2020
commit 377f9d85809329974f5f349c155717f9cbd40da3
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.apache.spark.sql.catalyst.expressions.{And, PredicateHelper}
import org.apache.spark.sql.catalyst.plans._
import org.apache.spark.sql.catalyst.plans.logical.{Filter, Join, LogicalPlan}
import org.apache.spark.sql.catalyst.rules.Rule
import org.apache.spark.sql.internal.SQLConf

/**
* Try converting join condition to conjunctive normal form expression so that more predicates may
Expand All @@ -33,7 +32,7 @@ object PushCNFPredicateThroughJoin extends Rule[LogicalPlan] with PredicateHelpe
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
case j @ Join(left, right, joinType, Some(joinCondition), hint) =>
val predicates = conjunctiveNormalForm(joinCondition)
if (predicates.isEmpty || predicates.size > SQLConf.get.maxCnfNodeCount) {
if (predicates.isEmpty) {
j
} else {
val pushDownCandidates = predicates.filter(_.deterministic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class ConjunctiveNormalFormPredicateSuite extends SparkFunSuite with PredicateHe
private val d = AttributeReference("D", BooleanType)(exprId = ExprId(4)).withQualifier(Seq("td"))
private val e = AttributeReference("E", BooleanType)(exprId = ExprId(5)).withQualifier(Seq("te"))
private val f = AttributeReference("F", BooleanType)(exprId = ExprId(6)).withQualifier(Seq("tf"))
private val g = AttributeReference("C", BooleanType)(exprId = ExprId(7)).withQualifier(Seq("tg"))
private val h = AttributeReference("D", BooleanType)(exprId = ExprId(8)).withQualifier(Seq("th"))
private val i = AttributeReference("E", BooleanType)(exprId = ExprId(9)).withQualifier(Seq("ti"))
private val j = AttributeReference("F", BooleanType)(exprId = ExprId(10)).withQualifier(Seq("tj"))
private val g = AttributeReference("G", BooleanType)(exprId = ExprId(7)).withQualifier(Seq("tg"))
private val h = AttributeReference("H", BooleanType)(exprId = ExprId(8)).withQualifier(Seq("th"))
private val i = AttributeReference("I", BooleanType)(exprId = ExprId(9)).withQualifier(Seq("ti"))
private val j = AttributeReference("J", BooleanType)(exprId = ExprId(10)).withQualifier(Seq("tj"))
private val a1 =
AttributeReference("a1", BooleanType)(exprId = ExprId(11)).withQualifier(Seq("ta"))
private val a2 =
Expand Down