Skip to content

Commit bd19807

Browse files
committed
Rename EqualsTo to EqualTo.
1 parent 81148d1 commit bd19807

File tree

11 files changed

+30
-30
lines changed

11 files changed

+30
-30
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SqlParser.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,13 @@ class SqlParser extends StandardTokenParsers with PackratParsers {
309309
comparisonExpression * (AND ^^^ { (e1: Expression, e2: Expression) => And(e1,e2) })
310310

311311
protected lazy val comparisonExpression: Parser[Expression] =
312-
termExpression ~ "=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => EqualsTo(e1, e2) } |
312+
termExpression ~ "=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => EqualTo(e1, e2) } |
313313
termExpression ~ "<" ~ termExpression ^^ { case e1 ~ _ ~ e2 => LessThan(e1, e2) } |
314314
termExpression ~ "<=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => LessThanOrEqual(e1, e2) } |
315315
termExpression ~ ">" ~ termExpression ^^ { case e1 ~ _ ~ e2 => GreaterThan(e1, e2) } |
316316
termExpression ~ ">=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => GreaterThanOrEqual(e1, e2) } |
317-
termExpression ~ "!=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => Not(EqualsTo(e1, e2)) } |
318-
termExpression ~ "<>" ~ termExpression ^^ { case e1 ~ _ ~ e2 => Not(EqualsTo(e1, e2)) } |
317+
termExpression ~ "!=" ~ termExpression ^^ { case e1 ~ _ ~ e2 => Not(EqualTo(e1, e2)) } |
318+
termExpression ~ "<>" ~ termExpression ^^ { case e1 ~ _ ~ e2 => Not(EqualTo(e1, e2)) } |
319319
termExpression ~ RLIKE ~ termExpression ^^ { case e1 ~ _ ~ e2 => RLike(e1, e2) } |
320320
termExpression ~ REGEXP ~ termExpression ^^ { case e1 ~ _ ~ e2 => RLike(e1, e2) } |
321321
termExpression ~ LIKE ~ termExpression ^^ { case e1 ~ _ ~ e2 => Like(e1, e2) } |

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ trait HiveTypeCoercion {
234234
def apply(plan: LogicalPlan): LogicalPlan = plan transformAllExpressions {
235235
// Skip nodes who's children have not been resolved yet.
236236
case e if !e.childrenResolved => e
237-
// No need to change EqualsTo operators as that actually makes sense for boolean types.
238-
case e: EqualsTo => e
237+
// No need to change EqualTo operators as that actually makes sense for boolean types.
238+
case e: EqualTo => e
239239
// Otherwise turn them to Byte types so that there exists and ordering.
240240
case p: BinaryComparison
241241
if p.left.dataType == BooleanType && p.right.dataType == BooleanType =>
@@ -254,7 +254,7 @@ trait HiveTypeCoercion {
254254
// Skip if the type is boolean type already. Note that this extra cast should be removed
255255
// by optimizer.SimplifyCasts.
256256
case Cast(e, BooleanType) if e.dataType == BooleanType => e
257-
case Cast(e, BooleanType) => Not(EqualsTo(e, Literal(0)))
257+
case Cast(e, BooleanType) => Not(EqualTo(e, Literal(0)))
258258
case Cast(e, dataType) if e.dataType == BooleanType =>
259259
Cast(If(e, Literal(1), Literal(0)), dataType)
260260
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import org.apache.spark.sql.catalyst.types._
4444
*
4545
* // These unresolved attributes can be used to create more complicated expressions.
4646
* scala> 'a === 'b
47-
* res2: org.apache.spark.sql.catalyst.expressions.EqualsTo = ('a = 'b)
47+
* res2: org.apache.spark.sql.catalyst.expressions.EqualTo = ('a = 'b)
4848
*
4949
* // SQL verbs can be used to construct logical query plans.
5050
* scala> import org.apache.spark.sql.catalyst.plans.logical._
@@ -76,8 +76,8 @@ package object dsl {
7676
def <= (other: Expression) = LessThanOrEqual(expr, other)
7777
def > (other: Expression) = GreaterThan(expr, other)
7878
def >= (other: Expression) = GreaterThanOrEqual(expr, other)
79-
def === (other: Expression) = EqualsTo(expr, other)
80-
def !== (other: Expression) = Not(EqualsTo(expr, other))
79+
def === (other: Expression) = EqualTo(expr, other)
80+
def !== (other: Expression) = Not(EqualTo(expr, other))
8181

8282
def like(other: Expression) = Like(expr, other)
8383
def rlike(other: Expression) = RLike(expr, other)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package org.apache.spark.sql.catalyst
2424
* expression, a [[NamedExpression]] in addition to the standard collection of expressions.
2525
*
2626
* ==Standard Expressions==
27-
* A library of standard expressions (e.g., [[Add]], [[EqualsTo]]), aggregates (e.g., SUM, COUNT),
27+
* A library of standard expressions (e.g., [[Add]], [[EqualTo]]), aggregates (e.g., SUM, COUNT),
2828
* and other computations (e.g. UDFs). Each expression type is capable of determining its output
2929
* schema as a function of its children's output schema.
3030
*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ trait PredicateHelper {
5252
*
5353
* For example consider a join between two relations R(a, b) and S(c, d).
5454
*
55-
* `canEvaluate(EqualsTo(a,b), R)` returns `true` where as `canEvaluate(EqualsTo(a,c), R)` returns
55+
* `canEvaluate(EqualTo(a,b), R)` returns `true` where as `canEvaluate(EqualTo(a,c), R)` returns
5656
* `false`.
5757
*/
5858
protected def canEvaluate(expr: Expression, plan: LogicalPlan): Boolean =
@@ -140,7 +140,7 @@ abstract class BinaryComparison extends BinaryPredicate {
140140
self: Product =>
141141
}
142142

143-
case class EqualsTo(left: Expression, right: Expression) extends BinaryComparison {
143+
case class EqualTo(left: Expression, right: Expression) extends BinaryComparison {
144144
def symbol = "="
145145
override def eval(input: Row): Any = {
146146
val l = left.eval(input)

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ object HashFilteredJoin extends Logging with PredicateHelper {
136136
val Join(left, right, joinType, _) = join
137137
val (joinPredicates, otherPredicates) =
138138
allPredicates.flatMap(splitConjunctivePredicates).partition {
139-
case EqualsTo(l, r) if (canEvaluate(l, left) && canEvaluate(r, right)) ||
139+
case EqualTo(l, r) if (canEvaluate(l, left) && canEvaluate(r, right)) ||
140140
(canEvaluate(l, right) && canEvaluate(r, left)) => true
141141
case _ => false
142142
}
143143

144144
val joinKeys = joinPredicates.map {
145-
case EqualsTo(l, r) if canEvaluate(l, left) && canEvaluate(r, right) => (l, r)
146-
case EqualsTo(l, r) if canEvaluate(l, right) && canEvaluate(r, left) => (r, l)
145+
case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, right) => (l, r)
146+
case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, left) => (r, l)
147147
}
148148

149149
// Do not consider this strategy if there are no join keys.

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ConstantFoldingSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ class ConstantFoldingSuite extends PlanTest {
195195
Add(Literal(null, IntegerType), 1) as 'c9,
196196
Add(1, Literal(null, IntegerType)) as 'c10,
197197

198-
EqualsTo(Literal(null, IntegerType), 1) as 'c11,
199-
EqualsTo(1, Literal(null, IntegerType)) as 'c12,
198+
EqualTo(Literal(null, IntegerType), 1) as 'c11,
199+
EqualTo(1, Literal(null, IntegerType)) as 'c12,
200200

201201
Like(Literal(null, StringType), "abc") as 'c13,
202202
Like("abc", Literal(null, StringType)) as 'c14,

sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetFilters.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ object ParquetFilters {
205205
Some(new AndFilter(leftFilter.get, rightFilter.get))
206206
}
207207
}
208-
case p @ EqualsTo(left: Literal, right: NamedExpression) if !right.nullable =>
208+
case p @ EqualTo(left: Literal, right: NamedExpression) if !right.nullable =>
209209
Some(createEqualityFilter(right.name, left, p))
210-
case p @ EqualsTo(left: NamedExpression, right: Literal) if !left.nullable =>
210+
case p @ EqualTo(left: NamedExpression, right: Literal) if !left.nullable =>
211211
Some(createEqualityFilter(left.name, right, p))
212212
case p @ LessThan(left: Literal, right: NamedExpression) if !right.nullable =>
213213
Some(createLessThanFilter(right.name, left, p))

sql/core/src/test/scala/org/apache/spark/sql/parquet/ParquetQuerySuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.apache.spark.sql.test.TestSQLContext
3333
import org.apache.spark.sql.TestData
3434
import org.apache.spark.sql.SchemaRDD
3535
import org.apache.spark.sql.catalyst.expressions.Row
36-
import org.apache.spark.sql.catalyst.expressions.EqualsTo
36+
import org.apache.spark.sql.catalyst.expressions.EqualTo
3737
import org.apache.spark.sql.catalyst.types.IntegerType
3838
import org.apache.spark.util.Utils
3939

@@ -245,7 +245,7 @@ class ParquetQuerySuite extends QueryTest with FunSuiteLike with BeforeAndAfterA
245245

246246
test("create RecordFilter for simple predicates") {
247247
val attribute1 = new AttributeReference("first", IntegerType, false)()
248-
val predicate1 = new EqualsTo(attribute1, new Literal(1, IntegerType))
248+
val predicate1 = new EqualTo(attribute1, new Literal(1, IntegerType))
249249
val filter1 = ParquetFilters.createFilter(predicate1)
250250
assert(filter1.isDefined)
251251
assert(filter1.get.predicate == predicate1, "predicates do not match")

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ private[hive] object HiveQl {
656656

657657
val joinConditions = joinExpressions.sliding(2).map {
658658
case Seq(c1, c2) =>
659-
val predicates = (c1, c2).zipped.map { case (e1, e2) => EqualsTo(e1, e2): Expression }
659+
val predicates = (c1, c2).zipped.map { case (e1, e2) => EqualTo(e1, e2): Expression }
660660
predicates.reduceLeft(And)
661661
}.toBuffer
662662

@@ -886,9 +886,9 @@ private[hive] object HiveQl {
886886
case Token("%", left :: right:: Nil) => Remainder(nodeToExpr(left), nodeToExpr(right))
887887

888888
/* Comparisons */
889-
case Token("=", left :: right:: Nil) => EqualsTo(nodeToExpr(left), nodeToExpr(right))
890-
case Token("!=", left :: right:: Nil) => Not(EqualsTo(nodeToExpr(left), nodeToExpr(right)))
891-
case Token("<>", left :: right:: Nil) => Not(EqualsTo(nodeToExpr(left), nodeToExpr(right)))
889+
case Token("=", left :: right:: Nil) => EqualTo(nodeToExpr(left), nodeToExpr(right))
890+
case Token("!=", left :: right:: Nil) => Not(EqualTo(nodeToExpr(left), nodeToExpr(right)))
891+
case Token("<>", left :: right:: Nil) => Not(EqualTo(nodeToExpr(left), nodeToExpr(right)))
892892
case Token(">", left :: right:: Nil) => GreaterThan(nodeToExpr(left), nodeToExpr(right))
893893
case Token(">=", left :: right:: Nil) => GreaterThanOrEqual(nodeToExpr(left), nodeToExpr(right))
894894
case Token("<", left :: right:: Nil) => LessThan(nodeToExpr(left), nodeToExpr(right))
@@ -928,7 +928,7 @@ private[hive] object HiveQl {
928928
// FIXME (SPARK-2155): the key will get evaluated for multiple times in CaseWhen's eval().
929929
// Hence effectful / non-deterministic key expressions are *not* supported at the moment.
930930
// We should consider adding new Expressions to get around this.
931-
Seq(EqualsTo(nodeToExpr(branches(0)), nodeToExpr(condVal)),
931+
Seq(EqualTo(nodeToExpr(branches(0)), nodeToExpr(condVal)),
932932
nodeToExpr(value))
933933
case Seq(elseVal) => Seq(nodeToExpr(elseVal))
934934
}.toSeq.reduce(_ ++ _)

0 commit comments

Comments
 (0)