spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takeshi Yamamuro (Jira)" <j...@apache.org>
Subject [jira] [Resolved] (SPARK-30147) Trim the string when cast string type to booleans
Date Sat, 07 Dec 2019 06:06:00 GMT

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

Takeshi Yamamuro resolved SPARK-30147.
--------------------------------------
    Fix Version/s: 3.0.0
         Assignee: Kent Yao
       Resolution: Fixed

Resolved by https://github.com/apache/spark/pull/26776

> Trim the string when cast string type to booleans
> -------------------------------------------------
>
>                 Key: SPARK-30147
>                 URL: https://issues.apache.org/jira/browse/SPARK-30147
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Kent Yao
>            Assignee: Kent Yao
>            Priority: Major
>             Fix For: 3.0.0
>
>
> Now, we trim the string when casting string value to those `canCast` types values, e.g.
int, double, decimal, interval, date, timestamps, except for boolean. 
> This behavior makes type cast and coercion inconsistency in Spark.
> Not fit ANSI SQL standard either.
> {code:java}
> If TD is boolean, then
> Case:
> a) If SD is character string, then SV is replaced by
>     TRIM ( BOTH ' ' FROM VE )
>     Case:
>     i) If the rules for literal in Subclause 5.3, “literal”, can be applied to SV
to determine a valid
> value of the data type TD, then let TV be that value.
>    ii) Otherwise, an exception condition is raised: data exception — invalid character
value for cast.
> b) If SD is boolean, then TV is SV
> {code}



--
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


Mime
View raw message