GitHub user jiangxb1987 opened a pull request:

    https://github.com/apache/spark/pull/21074

    [SPARK-21811][SQL] Fix the inconsistency behavior when finding the widest 
common type

    ## What changes were proposed in this pull request?
    
    Currently we find the wider common type by comparing the two types from 
left to right, this can be a problem when you have two data types which don't 
have a common type but each can be promoted to StringType.
    
    For instance, if you have a table with the schema:
    [c1: date, c2: string, c3: int]
    
    The following succeeds:
    SELECT coalesce(c1, c2, c3) FROM table
    
    While the following produces an exception:
    SELECT coalesce(c1, c3, c2) FROM table
    
    This is only a issue when the seq of dataTypes contains `StringType` and 
all the types can do string promotion.
    
    close #19033
    
    ## How was this patch tested?
    
    Add test in `TypeCoercionSuite`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jiangxb1987/spark typeCoercion

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21074.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21074
    
----
commit 803a6a443ba9f7d3dc34d68b0d15f53c1b6054fb
Author: Xingbo Jiang <xingbo.jiang@...>
Date:   2018-04-15T15:12:16Z

    fix type coercion when promting to StringType

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to