This is an automated email from the ASF dual-hosted git repository.

dbtsai pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new 23e35d4  [SPARK-26706][SQL][FOLLOWUP] Fix `illegalNumericPrecedence` 
for ByteType
23e35d4 is described below

commit 23e35d4f6cd75d3cc2a8054f8872fdf61c1a8bcc
Author: DB Tsai <d_t...@apple.com>
AuthorDate: Wed Jan 23 17:43:43 2019 -0800

    [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 <d_t...@apple.com>
    Signed-off-by: DB Tsai <d_t...@apple.com>
---
 .../spark/sql/catalyst/expressions/CastSuite.scala | 24 ----------------------
 1 file changed, 24 deletions(-)

diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
index 777295c..079fc6b 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
@@ -934,28 +934,4 @@ class CastSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     assert(Cast.mayTruncate(DoubleType, ByteType))
     assert(Cast.mayTruncate(DecimalType.IntDecimal, ByteType))
   }
-
-  test("canSafeCast and mayTruncate must be consistent for numeric types") {
-    import DataTypeTestUtils._
-
-    def isCastSafe(from: NumericType, to: NumericType): Boolean = (from, to) 
match {
-      case (_, dt: DecimalType) => dt.isWiderThan(from)
-      case (dt: DecimalType, _) => dt.isTighterThan(to)
-      case _ => numericPrecedence.indexOf(from) <= 
numericPrecedence.indexOf(to)
-    }
-
-    numericTypes.foreach { from =>
-      val (safeTargetTypes, unsafeTargetTypes) = numericTypes.partition(to => 
isCastSafe(from, to))
-
-      safeTargetTypes.foreach { to =>
-        assert(Cast.canSafeCast(from, to), s"It should be possible to safely 
cast $from to $to")
-        assert(!Cast.mayTruncate(from, to), s"No truncation is expected when 
casting $from to $to")
-      }
-
-      unsafeTargetTypes.foreach { to =>
-        assert(!Cast.canSafeCast(from, to), s"It shouldn't be possible to 
safely cast $from to $to")
-        assert(Cast.mayTruncate(from, to), s"Truncation is expected when 
casting $from to $to")
-      }
-    }
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to