Skip to content

Commit f4809c1

Browse files
committed
Move common functions to PredicateHelper.
1 parent ea8cea8 commit f4809c1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
package org.apache.spark.sql.catalyst.expressions
1919

20-
import org.apache.spark.sql.catalyst.trees
21-
import org.apache.spark.sql.catalyst.errors.TreeNodeException
2220
import org.apache.spark.sql.catalyst.analysis.UnresolvedException
23-
import org.apache.spark.sql.catalyst.types.{BooleanType, StringType, TimestampType}
21+
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
22+
import org.apache.spark.sql.catalyst.trees
23+
import org.apache.spark.sql.catalyst.types.BooleanType
24+
2425

2526
object InterpretedPredicate {
2627
def apply(expression: Expression): (Row => Boolean) = {
@@ -37,10 +38,17 @@ trait Predicate extends Expression {
3738
}
3839

3940
trait PredicateHelper {
40-
def splitConjunctivePredicates(condition: Expression): Seq[Expression] = condition match {
41+
protected def splitConjunctivePredicates(condition: Expression): Seq[Expression] = condition match {
4142
case And(cond1, cond2) => splitConjunctivePredicates(cond1) ++ splitConjunctivePredicates(cond2)
4243
case other => other :: Nil
4344
}
45+
46+
private def combineConjunctivePredicates(predicates: Seq[Expression]) =
47+
predicates.reduceLeft(And)
48+
49+
/** Returns true if `expr` can be evaluated using only the output of `plan`. */
50+
protected def canEvaluate(expr: Expression, plan: LogicalPlan): Boolean =
51+
expr.references subsetOf plan.outputSet
4452
}
4553

4654
abstract class BinaryPredicate extends BinaryExpression with Predicate {

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
6666
}
6767
case _ => Nil
6868
}
69-
70-
private def combineConjunctivePredicates(predicates: Seq[Expression]) =
71-
predicates.reduceLeft(And)
72-
73-
/** Returns true if `expr` can be evaluated using only the output of `plan`. */
74-
protected def canEvaluate(expr: Expression, plan: LogicalPlan): Boolean =
75-
expr.references subsetOf plan.outputSet
7669
}
7770

7871
object PartialAggregation extends Strategy {

0 commit comments

Comments
 (0)