You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Gengliang Wang (Jira)" <ji...@apache.org> on 2022/03/03 15:45:00 UTC

[jira] [Created] (SPARK-38407) ANSI Cast: loosen the limitation of casting non-null complex types

Gengliang Wang created SPARK-38407:
--------------------------------------

             Summary: ANSI Cast: loosen the limitation of casting non-null complex types
                 Key: SPARK-38407
                 URL: https://issues.apache.org/jira/browse/SPARK-38407
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 3.3.0, 3.2.2
            Reporter: Gengliang Wang
            Assignee: Gengliang Wang


When ANSI mode is off, `ArrayType(DoubleType, containsNull = false)` can't cast as `ArrayType(IntegerType, containsNull = false)` since there can be overflow thus result in null results and breaks the non-null constraint.

 

When ANSI mode is on, currently Spark SQL has the same behavior. However, this is not correct since the non-null constraint won't be break. Spark SQL can just execute the cast and throw runtime error on overflow, just like casting DoubleType as IntegerType.

 

This applies to MapType and StructType as well.

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org