You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "jingpan xiong (Jira)" <ji...@apache.org> on 2021/08/24 12:24:00 UTC

[jira] [Updated] (SPARK-35289) Make CatalogString contains nullable information

     [ https://issues.apache.org/jira/browse/SPARK-35289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jingpan xiong updated SPARK-35289:
----------------------------------
    Attachment: screenshot-1.png

> Make CatalogString contains nullable information
> ------------------------------------------------
>
>                 Key: SPARK-35289
>                 URL: https://issues.apache.org/jira/browse/SPARK-35289
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.1.1
>            Reporter: hezuojiao
>            Assignee: Apache Spark
>            Priority: Major
>         Attachments: screenshot-1.png
>
>
> When trying to cast ArrayType/MapType/StructType from containing NULL to not contain NULL, we will get a confusing failure message.
>  Here's a example:
> {code:java}
> // new UT in CastSuite
> test("array casting") {
>  val arrayContainsNull = Literal.create(Seq("contains", "null", null),
>  ArrayType(StringType, containsNull = true))
>  val ret = cast(arrayContainsNull, ArrayType(StringType, containsNull = false))
>  assert(ret.resolved === false)
>  // scalastyle:off println
>  println(ret.typeCheckFailureMessage)
>  // scalastyle:on println
> }
> {code}
> Failure massage:
> {code:java}
> cannot cast array<string> to array<string>{code}
> From the above error message, it is not clear why the error is reported, because the data type before and after is the same.
>  Therefore, I think we need to specify nullable info for ArrayType/MapType?/StructType in the Catalog String to identify the reason for Cast Failures.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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