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

srowen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new c902f77  [SPARK-34856][FOLLOWUP][SQL] Remove dead code from 
AnsiCast.typeCheckFailureMessage
c902f77 is described below

commit c902f77b42d8d24d967c6208980734840535797d
Author: Gengliang Wang <ltn...@gmail.com>
AuthorDate: Tue Mar 30 14:22:43 2021 -0500

    [SPARK-34856][FOLLOWUP][SQL] Remove dead code from 
AnsiCast.typeCheckFailureMessage
    
    ### What changes were proposed in this pull request?
    
    After https://github.com/apache/spark/pull/31954/, Array type is allowed to 
be cast as String type. So the customized conversion failure message branch 
from AnsiCast.typeCheckFailureMessage won't be reached anymore.
    This PR is to remove the dead code.
    
    ### Why are the changes needed?
    
    Code clean up.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    Just removing dead code.
    
    Closes #32004 from gengliangwang/SPARK-34856-followup.
    
    Authored-by: Gengliang Wang <ltn...@gmail.com>
    Signed-off-by: Sean Owen <sro...@gmail.com>
---
 .../scala/org/apache/spark/sql/catalyst/expressions/Cast.scala    | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
index 6332624..a696c40 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
@@ -1957,20 +1957,14 @@ object AnsiCast {
         suggestionOnConversionFunctions(from, to, "function UNIX_DATE")
 
       // scalastyle:off line.size.limit
-      case (_: ArrayType, StringType) =>
-        s"""
-           | cannot cast ${from.catalogString} to ${to.catalogString} with 
ANSI mode on.
-           | If you have to cast ${from.catalogString} to ${to.catalogString}, 
you can use the function ARRAY_JOIN or set $fallbackConfKey as 
$fallbackConfValue.
-           |""".stripMargin
-
       case _ if Cast.canCast(from, to) =>
         s"""
            | cannot cast ${from.catalogString} to ${to.catalogString} with 
ANSI mode on.
            | If you have to cast ${from.catalogString} to ${to.catalogString}, 
you can set $fallbackConfKey as $fallbackConfValue.
            |""".stripMargin
+      // scalastyle:on line.size.limit
 
       case _ => s"cannot cast ${from.catalogString} to ${to.catalogString}"
-      // scalastyle:on line.size.limit
     }
 }
 

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

Reply via email to