[ 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to