You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2021/03/17 05:03:00 UTC

[jira] [Assigned] (SPARK-34769) AnsiTypeCoercion: return narrowest convertible type among TypeCollection

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

Apache Spark reassigned SPARK-34769:
------------------------------------

    Assignee: Gengliang Wang  (was: Apache Spark)

> AnsiTypeCoercion: return narrowest convertible type among TypeCollection
> ------------------------------------------------------------------------
>
>                 Key: SPARK-34769
>                 URL: https://issues.apache.org/jira/browse/SPARK-34769
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.2.0
>            Reporter: Gengliang Wang
>            Assignee: Gengliang Wang
>            Priority: Major
>
> Currently, when implicit casting a data type to a `TypeCollection`, Spark returns the first convertible data type among `TypeCollection`.
> In ANSI mode, we can make the behavior more reasonable by returning the narrowest convertible data type in `TypeCollection`.
> In details,  we first try to find the all the expected types we can implicitly cast:
> 1. if there is no convertible data types, return None;
> 2. if there is only one convertible data type, cast input as it;
> 3. otherwise if there are multiple convertible data types, find the narrowest common data
>      type among them. If there is no such narrowest common data type, return None.
> Note that if the narrowest common type is Float type and the convertible types contains Double ype, simply return Double type as the narrowest common type to avoid potential
>  precision loss on converting the Integral type as Float type.



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