Skip to content

Commit 23e35d4

Browse files
committed
[SPARK-26706][SQL][FOLLOWUP] Fix illegalNumericPrecedence for ByteType
Removed automatically generated tests in ``` test("canSafeCast and mayTruncate must be consistent for numeric types") ``` since `canSafeCast` doesn't exit in 2.3 branch. We have enough test coverages in the explict casting tests. Authored-by: DB Tsai <[email protected]> Signed-off-by: DB Tsai <[email protected]>
1 parent de3b5c4 commit 23e35d4

File tree

1 file changed

+0
-24
lines changed
  • sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+0
-24
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -934,28 +934,4 @@ class CastSuite extends SparkFunSuite with ExpressionEvalHelper {
934934
assert(Cast.mayTruncate(DoubleType, ByteType))
935935
assert(Cast.mayTruncate(DecimalType.IntDecimal, ByteType))
936936
}
937-
938-
test("canSafeCast and mayTruncate must be consistent for numeric types") {
939-
import DataTypeTestUtils._
940-
941-
def isCastSafe(from: NumericType, to: NumericType): Boolean = (from, to) match {
942-
case (_, dt: DecimalType) => dt.isWiderThan(from)
943-
case (dt: DecimalType, _) => dt.isTighterThan(to)
944-
case _ => numericPrecedence.indexOf(from) <= numericPrecedence.indexOf(to)
945-
}
946-
947-
numericTypes.foreach { from =>
948-
val (safeTargetTypes, unsafeTargetTypes) = numericTypes.partition(to => isCastSafe(from, to))
949-
950-
safeTargetTypes.foreach { to =>
951-
assert(Cast.canSafeCast(from, to), s"It should be possible to safely cast $from to $to")
952-
assert(!Cast.mayTruncate(from, to), s"No truncation is expected when casting $from to $to")
953-
}
954-
955-
unsafeTargetTypes.foreach { to =>
956-
assert(!Cast.canSafeCast(from, to), s"It shouldn't be possible to safely cast $from to $to")
957-
assert(Cast.mayTruncate(from, to), s"Truncation is expected when casting $from to $to")
958-
}
959-
}
960-
}
961937
}

0 commit comments

Comments
 (0)