Skip to content

Commit 2e22330

Browse files
committed
Fixed unit tests.
1 parent 4932d57 commit 2e22330

File tree

5 files changed

+1
-28
lines changed

5 files changed

+1
-28
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,6 @@ case class MaxOf(left: Expression, right: Expression) extends BinaryArithmetic {
275275

276276
override def nullable: Boolean = left.nullable && right.nullable
277277

278-
protected def checkTypesInternal(t: DataType) =
279-
TypeUtils.checkForOrderingExpr(t, "function maxOf")
280-
281278
private lazy val ordering = TypeUtils.getOrdering(dataType)
282279

283280
override def eval(input: InternalRow): Any = {
@@ -333,9 +330,6 @@ case class MinOf(left: Expression, right: Expression) extends BinaryArithmetic {
333330

334331
override def nullable: Boolean = left.nullable && right.nullable
335332

336-
protected def checkTypesInternal(t: DataType) =
337-
TypeUtils.checkForOrderingExpr(t, "function minOf")
338-
339333
private lazy val ordering = TypeUtils.getOrdering(dataType)
340334

341335
override def eval(input: InternalRow): Any = {

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,6 @@ case class LessThan(left: Expression, right: Expression) extends BinaryCompariso
310310

311311
override def symbol: String = "<"
312312

313-
protected def checkTypesInternal(t: DataType) =
314-
TypeUtils.checkForOrderingExpr(left.dataType, "operator " + symbol)
315-
316313
private lazy val ordering = TypeUtils.getOrdering(left.dataType)
317314

318315
protected override def nullSafeEval(input1: Any, input2: Any): Any = ordering.lt(input1, input2)
@@ -325,9 +322,6 @@ case class LessThanOrEqual(left: Expression, right: Expression) extends BinaryCo
325322

326323
override def symbol: String = "<="
327324

328-
protected def checkTypesInternal(t: DataType) =
329-
TypeUtils.checkForOrderingExpr(left.dataType, "operator " + symbol)
330-
331325
private lazy val ordering = TypeUtils.getOrdering(left.dataType)
332326

333327
protected override def nullSafeEval(input1: Any, input2: Any): Any = ordering.lteq(input1, input2)
@@ -340,9 +334,6 @@ case class GreaterThan(left: Expression, right: Expression) extends BinaryCompar
340334

341335
override def symbol: String = ">"
342336

343-
protected def checkTypesInternal(t: DataType) =
344-
TypeUtils.checkForOrderingExpr(left.dataType, "operator " + symbol)
345-
346337
private lazy val ordering = TypeUtils.getOrdering(left.dataType)
347338

348339
protected override def nullSafeEval(input1: Any, input2: Any): Any = ordering.gt(input1, input2)
@@ -355,9 +346,6 @@ case class GreaterThanOrEqual(left: Expression, right: Expression) extends Binar
355346

356347
override def symbol: String = ">="
357348

358-
protected def checkTypesInternal(t: DataType) =
359-
TypeUtils.checkForOrderingExpr(left.dataType, "operator " + symbol)
360-
361349
private lazy val ordering = TypeUtils.getOrdering(left.dataType)
362350

363351
protected override def nullSafeEval(input1: Any, input2: Any): Any = ordering.gteq(input1, input2)

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ object TypeUtils {
3232
}
3333
}
3434

35-
def checkForBitwiseExpr(t: DataType, caller: String): TypeCheckResult = {
36-
if (t.isInstanceOf[IntegralType] || t == NullType) {
37-
TypeCheckResult.TypeCheckSuccess
38-
} else {
39-
TypeCheckResult.TypeCheckFailure(s"$caller accepts integral types, not $t")
40-
}
41-
}
42-
4335
def checkForOrderingExpr(t: DataType, caller: String): TypeCheckResult = {
4436
if (t.isInstanceOf[AtomicType] || t == NullType) {
4537
TypeCheckResult.TypeCheckSuccess

sql/catalyst/src/main/scala/org/apache/spark/sql/types/AbstractDataType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private[sql] object TypeCollection {
105105
ByteType, ShortType, IntegerType, LongType,
106106
FloatType, DoubleType, DecimalType,
107107
TimestampType, DateType,
108-
StringType)
108+
StringType, BinaryType)
109109

110110
/**
111111
* Types that can be used in bitwise operations.

sql/core/src/test/scala/org/apache/spark/sql/MathExpressionsSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,5 @@ class MathExpressionsSuite extends QueryTest {
375375
val df = Seq((1, -1, "abc")).toDF("a", "b", "c")
376376
checkAnswer(df.selectExpr("positive(a)"), Row(1))
377377
checkAnswer(df.selectExpr("positive(b)"), Row(-1))
378-
checkAnswer(df.selectExpr("positive(c)"), Row("abc"))
379378
}
380379
}

0 commit comments

Comments
 (0)